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-09 00:17:20 +08:00
|
|
|
|
|
2023-01-05 00:28:20 +08:00
|
|
|
|
#region <EFBFBD>麯<EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD>
|
2023-01-09 00:17:20 +08:00
|
|
|
|
public void InitMachine(Transform trans, S_ROLE_DATA_BASE data = null)
|
2023-01-05 00:28:20 +08:00
|
|
|
|
{
|
|
|
|
|
_animator = trans.GetComponent<Animator>();
|
2023-01-09 00:17:20 +08:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-07 23:24:18 +08:00
|
|
|
|
//public void SetAttack(string anim)
|
|
|
|
|
//{
|
|
|
|
|
// _animator.SetBool(anim, true);
|
|
|
|
|
//}
|
2023-01-05 00:28:20 +08:00
|
|
|
|
|
|
|
|
|
public void SetAttack(string anim)
|
|
|
|
|
{
|
2023-01-07 23:24:18 +08:00
|
|
|
|
_animator.Play(anim);
|
2023-01-05 00:28:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetOtherAnime(string anim)
|
|
|
|
|
{
|
|
|
|
|
_animator.Play(anim);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayDead()
|
|
|
|
|
{
|
2023-01-09 00:17:20 +08:00
|
|
|
|
_animator.Play("Dead");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayHit()
|
|
|
|
|
{
|
|
|
|
|
_animator.Play("Hurt");
|
2023-01-05 00:28:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-09 00:17:20 +08:00
|
|
|
|
public void SetAnimatorSpeed(float speed)
|
2023-01-05 00:28:20 +08:00
|
|
|
|
{
|
2023-01-09 00:17:20 +08:00
|
|
|
|
_animator.speed = speed;
|
2023-01-05 00:28:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|