//----------------------------------------------------------- #region Event /// <summary> /// StateMachine脚本触发Enter时调用 /// </summary> /// <param name="Event_Type">事件类型</param> /// <param name="Sender">发送者对象</param> /// <param name="Param">参数,可选</param> public void EnterEvent(EventManager.EVENT_TYPE Event_Type, Component Sender, object Param = null) { //发出对象为目前操作的角色 if (Sender.name.Equals("Player")) { switch ((string)Param) { case "Jump": OnjumpEnter(); break; case "Ground": OnGroundEnter(); break; case "Jab": OnJabEnter(); break; case "General": OnGeneralEnter(); break; default: Debug.Log("EnterEvent Error"); break; } } }
/// <summary> /// StateMachine脚本触发Update时调用 /// </summary> /// <param name="Event_Type">事件类型</param> /// <param name="Sender">发送者对象</param> /// <param name="Param">参数,可选</param> public void UpdateEvent(EventManager.EVENT_TYPE Event_Type, Component Sender, object Param = null) { if (Sender.name.Equals("Player")) { switch ((string)Param) { case "Roll": OnRollUpdate(); break; case "Jab": OnJabUpdate(); break; default: Debug.Log("FSM Error"); break; } } }
/// <summary> /// StateMachine脚本触发Exit时调用 /// </summary> /// <param name="Event_Type">事件类型</param> /// <param name="Sender">发送者对象</param> /// <param name="Param">参数,可选</param> public void ExitEvent(EventManager.EVENT_TYPE Event_Type, Component Sender, object Param = null) { if (Sender.name.Equals("Player")) { switch ((string)Param) { case "Ground": OnGroundExit(); break; case "Roll": RollExit(); break; case "Jab": OnJabExit(); break; default: Debug.Log("ExitEvent Error"); break; } } }