public override void OnUpdate() { base.OnUpdate(); if (Input.GetKeyDown(KeyCode.S)) { Debug.Log("ATAction_Input2 Tri"); MyFsm.ChangeState(ATFsm.StateID.Idle1.GetHashCode()); } }
/// <summary> /// 更新,内部调用 /// </summary> public void State_Update() { if (MyFsm == null) { return; } if (m_ReadyToEnter) { m_ReadyToEnter = false; State_Enter(); return;//隔开一帧,因为Enter里面可能继续发跳转变化 } if (m_Running == false) { return; } OnUpdate(); if (m_Actions != null) { if (m_SequnceAction == false) { foreach (Action ac in m_Actions) { if (!m_Running) { return; } if (ac.Finished == false) { ac.Action_Update(); } } } else { foreach (Action ac in m_Actions) { if (!m_Running) { return; } if (ac.Finished == false) { if (ac.Started == false) { ac.Action_Enter(); } else//Enter和Update隔开一帧,因为Enter可能把它结束了,方便控制状态 { ac.Action_Update(); } break; } } } } if (m_Transitions != null) { foreach (Transition tr in m_Transitions) { if (!m_Running) { return; } if (tr != null && tr.Check()) { MyFsm.ChangeState(tr.NextID); return; } } } }