public void ChangeState(GenericState newState) { if (myState != newState) { myState = newState; } }
public bool ChangeCurrentState(string stateName) { if (currentState == null || currentState.stateName != stateName) { // Need to stop the update of the state! if (updateStateCoroutine != null) { StopCoroutine(updateStateCoroutine); } // the current state is still active, make it inactive and reset current state if (currentState != null) { currentState.resetState(); } // We loop it because no time to code faster search for states foreach (GenericState state in m_AllGenericStates) { if (state.stateName == stateName) { // then set the state and begin the update! state.enabled = true; currentState = state; updateStateCoroutine = StartCoroutine(UpdatingStates()); break; } } return(true); } return(false); }
/// <summary> /// 创建一个泛型参数 /// </summary> /// <returns></returns> public virtual TBuilder WithCreate(string name) { _this = new GenericState(); _this.Name = name; _generic.Add(_this); return(_TBuilder); }
public void AddState(GenericState <TBase> state) { if (state == null || StateList.Contains(state)) { return; } StateList.Add(state); }
public FirebaseWithCloudAnchorDb(FirebaseWrapper firebaseWrapper, CloudAnchorsWrapper cloudAnchorsWrapper, Logger logger) { this.firebaseWrapper = firebaseWrapper; this.cloudAnchorsWrapper = cloudAnchorsWrapper; this.logger = logger; this.observers = new List <IDatabaseObserver>(); GenericState <FirebaseWithCloudAnchorDb> .InitState <SReady>(this); }
public void TransitState(GenericState <TBase> target) // 名前が微妙かも { if (target == null || !StateList.Contains(target)) { return; } TransitTo(target); }
public void SetCurrentState(GenericState <TBase> state) { if (state == null || !StateList.Contains(state)) { return; } CurrentState = state; Debug.Log(gameObject.name + "is now State: " + CurrentState.Name); }
public TouchDetector(PlaneTouchHandler planeTouchHandler, VirtualObjectTouchHandler virtualObjectTouchHandler, ARRaycastManager arRaycastmanager, Logger logger) { this.planeTouchHandler = planeTouchHandler; this.virtualObjectTouchHandler = virtualObjectTouchHandler; this.arRaycastmanager = arRaycastmanager; this.logger = logger; this.lastTouch = null; this.lastTouchResolved = false; GenericState <TouchDetector> .InitState <SNoTouch>(this); }
private void ChangeState(StateTransition <Data> stateTransition) { if (!stateTransition.IsNull) { if (m_currentState != null) { m_currentState.ExitState(); } m_currentState = GetCachedState(stateTransition.StateType); m_currentState.OpenState(stateTransition.StateData); } }
private GenericState <Data> GetCachedState(Type stateType) { if (m_statesCache.ContainsKey(stateType)) { return(m_statesCache[stateType]); } else { GenericState <Data> newState = (GenericState <Data>)Activator.CreateInstance(stateType); m_statesCache.Add(stateType, newState); return(newState); } }
private void TransitTo(GenericState <TBase> target) // null検証はしてません. { lock (locker) { if (CurrentState.OnExit != null) { CurrentState.OnExit(); } CurrentState = target; if (CurrentState.OnEnter != null) { CurrentState.OnEnter(); } } }
/// <summary> /// The coroutine to update the state update! /// </summary> /// <returns></returns> IEnumerator UpdatingStates() { // because the state should update on their own! Coroutine stateCoroutine = currentState.StartCoroutine(currentState.updateState()); yield return(stateCoroutine); // reset the value once the update is done! if (currentState) { currentState.resetState(); currentState = null; } updateStateCoroutine = null; yield break; }
public void SetCurrentState(string stateName) { if (stateName == null) { return; // これがいるかは不明. } var targetState = StateList.Find(s => s.Name == stateName); if (targetState == null) { Debug.Log(stateName + "instance has not been \"new\"ed."); return; } CurrentState = targetState; Debug.Log(gameObject.name + "is set to State: " + CurrentState.Name); }
public void SetState <ConcreteContext>(GenericState <ConcreteContext> state) where ConcreteContext : IStateContext { this.databaseState = (DatabaseStateBase)(object)state; }
public GenericStateContex() { CurrentState = null; }
/// <summary> /// 结束一个泛型参数的设计 /// </summary> /// <returns></returns> public virtual GenericTemplate <TBuilder> WithEnd() { _this = null; return(this); }
void SetState(GenericState newState) { myState.ChangeState(newState); }