AkiraPixelWind/Assets/Scripts/Main/Role/CharacterMachine/CharacterMachine.cs

96 lines
2.0 KiB
C#
Raw Normal View History

2023-01-05 00:28:20 +08:00
using Game;
using Game.HotFix;
using System.Collections.Generic;
using UnityEngine;
namespace Game
{
public class CharacterMachine : ICharMachineBase //<2F>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>MonoBehaviour <20><><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>
{
private Animator _animator;
public bool IsAttacking()
{
AnimatorStateInfo stateInfo = _animator.GetCurrentAnimatorStateInfo(0);
2023-01-05 18:32:58 +08:00
if (stateInfo.IsName("Idle"))
2023-01-05 00:28:20 +08:00
return false;
if (stateInfo.IsName("Run"))
return false;
if (stateInfo.IsName("Hit"))
return false;
return true;
}
2023-01-05 00:28:20 +08:00
#region <EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD>
public void InitMachine(Transform trans, S_ROLE_DATA_BASE data = null)
2023-01-05 00:28:20 +08:00
{
_animator = trans.GetComponent<Animator>();
if (data != null)
{
_animator.SetInteger("RoleID", (int)data.innate.roleid);
_animator.SetInteger("NodeType", (int)data.RoleType);
}
2023-01-05 00:28:20 +08:00
}
public void ReleazeMachine()
{
_animator = null;
}
public void Update_Logic()
{ }
public void StartRun()
{
_animator.SetInteger("Speed", 1);
}
public void BackToIdle()
{
_animator.SetInteger("Speed", 0);
}
public void DeadToIdle()
{
_animator.SetBool("Dead", false);
}
//public void SetAttack(string anim)
//{
// _animator.SetBool(anim, true);
//}
2023-01-05 00:28:20 +08:00
public void SetAttack(string anim)
{
_animator.Play(anim);
2023-01-05 00:28:20 +08:00
}
public void SetOtherAnime(string anim)
{
_animator.Play(anim);
}
public void PlayDead()
{
_animator.Play("Dead");
}
public void PlayHit()
{
_animator.Play("Hurt");
2023-01-05 00:28:20 +08:00
}
public void SetAnimatorSpeed(float speed)
2023-01-05 00:28:20 +08:00
{
_animator.speed = speed;
2023-01-05 00:28:20 +08:00
}
#endregion
}
}