public void OnEnter(IStateNodeService from) { ServiceLocator.Get <IPattern2>().Print(); ServiceLocator.Get <Pattern3>().Print(); ServiceLocator.Get <Pattern4>().Print(); ServiceLocator.Get <Pattern1>().Value = 1f; }
protected virtual void InitializeStateMachineCore() { stateMachineCore = new StateMachineCore <IStateNodeService>(UpdateStateNodeStatus, false); stateNodeList.StateNodes.ForEach(node => stateMachineCore.RegisterStateNode(node, new StateNodeCore <IStateNodeService>(node, stateMachineCore))); var stateNode = stateNodeList.GetStateNode(stateNodeList.FirstState.GetType()); if (stateNode != null) { CurrentState = stateNode; PreviousState = stateNode; StartCoroutine(STMCore.StartStateMachine(stateNode)); } }
public virtual void UpdateState <NODE_TYPE>() where NODE_TYPE : IStateNodeService { var stateNode = stateNodeList.GetStateNode <NODE_TYPE>(); if (stateNode != null) { bool isSuccess = STMCore.TryMoveState(stateNode); if (isSuccess) { PreviousState = CurrentState; CurrentState = stateNode; } } }
public virtual void UpdateState(Type type) { var stateNode = stateNodeList.GetStateNode(type); if (stateNode != null) { bool isSuccess = STMCore.TryMoveState(stateNode); if (isSuccess) { PreviousState = CurrentState; CurrentState = stateNode; } } }
protected virtual IEnumerator UpdateStateNodeStatus(IStateNodeService stateType, eStateNodeStatus stateStatus) { var stateNode = stateNodeList.GetStateNode(stateType.GetType()); if (stateNode == null) { yield break; } if (stateStatus != eStateNodeStatus.StateInitialize) { yield return(null); } switch (stateStatus) { case eStateNodeStatus.StateInitialize: Debug.Log($"{stateNode.GetType().BaseType}-{stateNode.GetType()}-{stateStatus}"); stateNode?.Initialize(); break; case eStateNodeStatus.StateEnter: Debug.Log($"{stateNode.GetType().BaseType}-{stateNode.GetType()}-{stateStatus}"); stateNode?.OnEnter(PreviousState); break; case eStateNodeStatus.StateUpdate: // Debug.Log($"{stateType.GetType().BaseType}-{stateType.GetType()}-{stateStatus}"); //node?.OnUpdate(); break; case eStateNodeStatus.StateExit: Debug.Log($"{stateNode.GetType().BaseType}-{stateNode.GetType()}-{stateStatus}"); stateNode?.OnExit(CurrentState); break; case eStateNodeStatus.StateFinalize: break; } }
public void OnExit(IStateNodeService to) { }
public void OnEnter(IStateNodeService from) { IsTransition = true; }
public void OnEnter(IStateNodeService from) { }
public void OnEnter(IStateNodeService from) { anyParameter = ServiceLocator.Get <IAnyParameter>(); }
public void OnEnter(IStateNodeService from) { var type = typeof(Step3_CanRegisterAnyInstanceToServiceLocatorState); ServiceLocator.Get <IStateMachineService>().UpdateState(type); }