using Game; using Game.HotFix; using System.Collections.Generic; using UnityEngine; namespace Game { public class CharacterMachine : ICharMachineBase //是否使用其他基类或是否使用MonoBehaviour 靠外部驱动,按需修改 { private Animator _animator; public bool IsAttacking() { AnimatorStateInfo stateInfo = _animator.GetCurrentAnimatorStateInfo(0); if (stateInfo.IsName("Idle")) return false; if (stateInfo.IsName("Run")) return false; if (stateInfo.IsName("Hit")) return false; return true; } #region 虚函数实现 public void InitMachine(Transform trans) { _animator = trans.GetComponent(); } 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); } public void SetOtherAnime(string anim) { _animator.Play(anim); } public void PlayDead() { _animator.SetBool("Dead", true); } public void StartHit() { _animator.SetBool("Hit", true); } #endregion } }