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


C# IState.OnEnter方法代码示例

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


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

示例1: ChangeState

 public void ChangeState(IState _state)
 {
     IState prevState = currState;
     if (_state != currState && _state != null)
     {
         prevState.OnExit();
         currState = _state;
         currState.OnEnter();
     }
 }
开发者ID:Jeedan,项目名称:LD33,代码行数:10,代码来源:StateMachine.cs

示例2: TransitionTo

        public void TransitionTo(IState state)
        {
            if (!(state is IdleState) && !_stackState.Contains(state))
                _stackState.Add(state);

            CurrentState = state;
            CurrentState.FiniteStateMachine = this;
            CurrentState.OnLeave = OnStateLeave;

            Log.Write("Transition to: {0}", state.GetType(), ConsoleColor.Red);

            CurrentState.OnEnter();
        }
开发者ID:PawelklosPL,项目名称:GameDevelopment,代码行数:13,代码来源:FiniteStateMachine.cs

示例3: ChangeState

        public void ChangeState(IState  newState)
        {
            if (newState == null)
                throw new ArgumentNullException("newState","The input state cannot be null");

            PreviousState = CurrentState;

            if (CurrentState != null)
                CurrentState.OnExit(new AgentEventArgs<Agent>(Agent));

            CurrentState = newState;

            CurrentState.OnEnter(new AgentEventArgs<Agent>(Agent));
        }
开发者ID:vladdie,项目名称:Autonomous-Agents,代码行数:14,代码来源:StateMachine.cs

示例4: PushNovelState

 public void PushNovelState(IState state)
 {
     stateStack.Add(state);
     state.OnEnter();
 }
开发者ID:InferiorOlive,项目名称:AIQuest,代码行数:5,代码来源:StateMachine.cs

示例5: ChangeState

 void ChangeState(IState newState)
 {
     if(state != null) state.OnExit();
     state = newState;
     StateInputHandler = state;
     if (state != null) state.OnEnter();
     if (StateChanged != null) StateChanged(this, null);
 }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:8,代码来源:WorldView.cs

示例6: Start

    // Use this for initialization
    void Start()
    {
        myRigidbody = GetComponent<Rigidbody2D>();

        // instantiate dictionary and add states
        states = new Dictionary<string, IState>();
        states.Add(IdleState, new PlayerIdleState());
        states.Add(RunState, new PlayerRunState());
        states.Add(JumpState, new PlayerJumpState());

        if (floorLayer == 0) // if floor layer has not been set in the inspector, set it to layer named Floor
        {
            floorLayer = LayerMask.GetMask("Floor");
        }

        // set the current state to Idle
        currentState = states[IdleState];
        currentState.OnEnter(this);
    }
开发者ID:Feich,项目名称:2DPlatformerExample,代码行数:20,代码来源:SimplePlayerController.cs

示例7: Change

 public void Change(States stateName, params object[] optional)
 {
     mCurrentState.OnExit();
     mCurrentState = mStates[stateName];
     mCurrentState.OnEnter(optional);
 }
开发者ID:ericbutera,项目名称:goatsharp,代码行数:6,代码来源:Game.cs

示例8: ChangeState

 void ChangeState(IState newState)
 {
     if (state != null) state.OnExit();
     state = newState;
     if (state != null) state.OnEnter();
 }
开发者ID:ChristianMarchiori,项目名称:DeadMeetsLead,代码行数:6,代码来源:SceneEditor.cs


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