当前位置: 首页>>代码示例>>C#>>正文


C# State.OnEnter方法代码示例

本文整理汇总了C#中State.OnEnter方法的典型用法代码示例。如果您正苦于以下问题:C# State.OnEnter方法的具体用法?C# State.OnEnter怎么用?C# State.OnEnter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在State的用法示例。


在下文中一共展示了State.OnEnter方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MoveTo

		public void MoveTo(State state) {
			if (stateStack.Count > 0) {
				var top = stateStack.Pop();
				top.OnExit();
				stateStack.Clear();
			}
			state.StateMachine = this;
			stateStack.Push(state);
			state.OnEnter();
		}
开发者ID:coderespawn,项目名称:dungeon-architect-quick-start-unity,代码行数:10,代码来源:StateMachine.cs

示例2: AddState

        public void AddState(Enum name, Action<Enum> enterCallback, Action updateCallback, Action<Enum> exitCallback)
        {
            State state = new State (name, enterCallback, updateCallback, exitCallback);
            this.states.Add (state.Name, state);

            if (null == this.currentState) {
                this.currentState = state;
                state.OnEnter (null);
            }
        }
开发者ID:coinflipgamesllc,项目名称:fsm,代码行数:10,代码来源:StateMachine.cs

示例3: SetState

    protected void SetState(int stateID)
    {
        if (_curState != null)
            _curState.OnLeave(this);

        _curState = _dicStates[stateID];
        _curStateID = stateID;

        _curState.OnEnter(this);
    }
开发者ID:kimha578,项目名称:jwUnityStudy,代码行数:10,代码来源:CharacterState.cs

示例4: Awake

    void Awake()
    {
        states = new Dictionary<System.Type, State> ();
        states.Add(typeof(FlyingState), new FlyingState(this));
        states.Add(typeof(BarrelRollLeft), new BarrelRollLeft(this));
        states.Add(typeof(BarrelRollRight), new BarrelRollRight(this));
        states.Add(typeof(TrainTransition), new TrainTransition(this));

        currentState = states[typeof(FlyingState)];
        currentState.OnEnter();
    }
开发者ID:coastwise,项目名称:ggj2013,代码行数:11,代码来源:ShipController.cs

示例5: Start

    /// <summary>
    /// This calls initialize on each state in the fsm. 
    /// </summary>
    protected virtual void Start()
    {
        SetStates();

        Initialize();

        foreach ( State state in states.Values )
        {
            state.Initialize(this);
        }

        currentState = states.Values.ElementAt( 0 );
        currentState.OnEnter();
    }
开发者ID:tory37,项目名称:RubyNeilPert,代码行数:17,代码来源:MonoFSM.cs

示例6: ForceChangeToState

 public void ForceChangeToState(State newState)
 {
     currentState = newState; // Update the current state
     newState.OnEnter(); // Enter the new state
 }
开发者ID:10DaysLeftToLive,项目名称:TimeWhaleEngine,代码行数:5,代码来源:Character.cs

示例7: EnterState

 public void EnterState(State newState)
 {
     currentState.OnExit(); // Exit the current state
     currentState = newState; // Update the current state
     newState.OnEnter(); // Enter the new state
 }
开发者ID:10DaysLeftToLive,项目名称:TimeWhaleEngine,代码行数:6,代码来源:Character.cs

示例8: SetStateInternal

    private bool SetStateInternal()
    {
        if(_currentState != null)
        {
            if(_currentState.OnExit != null)
            {_currentState.OnExit();}

            _currentState.ProcessLinkTo(nextState);
            _lastState = _currentState.Name;
        }

        _currentState = _stateList[nextState];
        nextState = "";
        Logger.Log(_name + " - Entering State: " + _currentState.Name, 0);

        if(_currentState != null && _currentState.OnEnter != null)
        {_currentState.OnEnter();}

        return true;
    }
开发者ID:crawson7,项目名称:OnyxSidewinder,代码行数:20,代码来源:StateMachine.cs

示例9: state_change_me

 public void state_change_me(State current, State newstate)
 {
     int index = list.IndexOf(current);
     if (index == -1)
     {
         Debug.LogError("state_change_me(" + current + ", " + newstate + ") : " + current + " introuvable !");
         return;
     }
     while (index > 0)
     {
         index--;
         list[index].OnLeave();
     }
     current.OnLeave();
     index = list.IndexOf(current);
     if (index == -1)
     {
         Debug.LogError("state_change_son(" + current + ", " + newstate + ") : " + current + ".OnLeave() ne doit pas changer l'�tat !");
         return;
     }
     list.RemoveRange(0, index + 1);
     list.Insert(0, newstate);
     newstate.OnEnter();
     index = list.IndexOf(newstate);
     if (index != -1 && list.Count > index + 1)
         list[index + 1].OnChildChanged();
 }
开发者ID:sylafrs,项目名称:rugby,代码行数:27,代码来源:StateMachine.cs

示例10: PushTo

		public void PushTo(State state) {
			state.StateMachine = this;
			stateStack.Push(state);
			state.OnEnter();
		}
开发者ID:coderespawn,项目名称:dungeon-architect-quick-start-unity,代码行数:5,代码来源:StateMachine.cs

示例11: EnterState

 public void EnterState(System.Type newStateType)
 {
     currentState.OnExit();
     currentState = states[newStateType];
     currentState.OnEnter();
 }
开发者ID:coastwise,项目名称:ggj2013,代码行数:6,代码来源:ShipController.cs


注:本文中的State.OnEnter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。