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


C# FSMState.addTransition方法代码示例

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


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

示例1: initializeDefStates

    public void initializeDefStates()
    {
        //should this be hardcoded?
        FSMState fall = new FSMState(PlayerStates.FALLING);
        fall.addTransition(PlayerActions.LAND,PlayerStates.STANDING);
        fsmStates.Add(fall);

        FSMState stand = new FSMState(PlayerStates.STANDING);
        stand.addTransition(PlayerActions.WALK_INPUT,PlayerStates.WALKING);
        stand.addTransition(PlayerActions.RUN_INPUT,PlayerStates.RUNNING);
        stand.addTransition(PlayerActions.JUMP_INPUT,PlayerStates.JUMPING);
        fsmStates.Add(stand);

        FSMState walk = new FSMState(PlayerStates.WALKING);
        walk.addTransition(PlayerActions.RUN_INPUT,PlayerStates.RUNNING);
        walk.addTransition(PlayerActions.JUMP_INPUT,PlayerStates.JUMPING);
        walk.addTransition(PlayerActions.STOP,PlayerStates.STANDING);
        walk.addTransition(PlayerActions.FALL,PlayerStates.FALLING);
        fsmStates.Add(walk);

        FSMState run = new FSMState(PlayerStates.RUNNING);
        run.addTransition(PlayerActions.WALK_INPUT,PlayerStates.WALKING);
        run.addTransition(PlayerActions.JUMP_INPUT,PlayerStates.JUMPING);
        run.addTransition(PlayerActions.STOP,PlayerStates.STANDING);
        run.addTransition(PlayerActions.FALL,PlayerStates.FALLING);
        fsmStates.Add(run);

        FSMState jump = new FSMState(PlayerStates.JUMPING);
        jump.addTransition(PlayerActions.FALL,PlayerStates.FALLING);
        jump.addTransition(PlayerActions.JUMP_INPUT,PlayerStates.JUMPING);
        fsmStates.Add(jump);
    }
开发者ID:OscarRPR,项目名称:SR_PC,代码行数:32,代码来源:PlayerFSM.cs

示例2: initializeDefStates

    public void initializeDefStates()
    {
        FSMState fall = new FSMState(PlayerStates.FALLING);
        fall.addTransition(PlayerActions.RUN, PlayerStates.RUNNING);
        fall.addTransition(PlayerActions.JUMP_INPUT, PlayerStates.FALL_JUMP);
        fsmStates.Add(fall);

        FSMState run = new FSMState(PlayerStates.RUNNING);
        run.addTransition(PlayerActions.JUMP_INPUT, PlayerStates.JUMPING);
        run.addTransition(PlayerActions.FALL, PlayerStates.FALLING);
        fsmStates.Add(run);

        FSMState jump = new FSMState(PlayerStates.JUMPING);
        jump.addTransition(PlayerActions.FALL, PlayerStates.FALLING);
        jump.addTransition(PlayerActions.JUMP_INPUT, PlayerStates.DOUBLE_JUMPING);
        jump.addTransition(PlayerActions.WALL_SLIDE, PlayerStates.WALL_SLIDING);
        fsmStates.Add(jump);

        FSMState doubleJump = new FSMState(PlayerStates.DOUBLE_JUMPING);
        doubleJump.addTransition(PlayerActions.FALL, PlayerStates.FALLING);
        doubleJump.addTransition(PlayerActions.WALL_SLIDE, PlayerStates.WALL_SLIDING);
        fsmStates.Add(doubleJump);

        FSMState fallJump = new FSMState(PlayerStates.FALL_JUMP);
        fallJump.addTransition(PlayerActions.FALL, PlayerStates.RUNNING);
        fsmStates.Add(fallJump);

        FSMState wallSliding = new FSMState(PlayerStates.WALL_SLIDING);
        wallSliding.addTransition(PlayerActions.RUN, PlayerStates.RUNNING);
        wallSliding.addTransition(PlayerActions.JUMP_INPUT, PlayerStates.JUMPING);
        fsmStates.Add(wallSliding);
    }
开发者ID:OscarRPR,项目名称:prototype-infinite-runner,代码行数:32,代码来源:PlayerFSM.cs


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