public void ChangeState(Boss2_state newState) { if (currentState != null) { currentState.LeaveState(this); } currentState = newState; if (currentState != null) { currentState.EnterState(this); } }
public void Start() { timeUnit = GM.timeUnit; speedUnit *= moveUnit / timeUnit; thisAnim.SetFloat("unit", 1 / timeUnit); idle = gameObject.GetComponent <Boss2_state_idle>(); attack1 = gameObject.GetComponent <Boss2_state_attack1>(); attack2 = gameObject.GetComponent <Boss2_state_attack2>(); attack3 = gameObject.GetComponent <Boss2_state_attack3>(); crush = gameObject.GetComponent <Boss2_state_crush>(); recovery = gameObject.GetComponent <Boss2_state_recover>(); currentState = idle; currentState.EnterState(this); Hp = MaxHp; }