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


C# FiniteStateMachine.AddState方法代码示例

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


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

示例1: Start

 // Use this for initialization
 void Start()
 {
     stateMachine = GetComponent<FiniteStateMachine>();
     stateMachine.InitializeStateMachine();
     stateMachine.AddState(new BomberReachedScreenEdge(this.transform));
     stateMachine.AddState(new BomberAttackingPlayer(this.transform, GameManager.instance.GetPlayer()));
     stateMachine.AddState(new BomberMovingToPosition(this.transform));
     stateMachine.AddState(new BomberDead(this.transform));
 }
开发者ID:Broghain,项目名称:GTO7,代码行数:10,代码来源:BomberController.cs

示例2: Awake

    protected void Awake()
    {
        _fsm = new FiniteStateMachine();

        _fsm.AddState(new HeroSeekState(gameObject));
        _fsm.AddState(new HeroWalkState(gameObject));
        _fsm.AddState(new HeroWaitState(gameObject));

        //_fsm.ChangeState(new FSMTransition(HeroState.Seek));
    }
开发者ID:jtuttle,项目名称:umbra-client,代码行数:10,代码来源:HeroAI.cs

示例3: Start

 // Use this for initialization
 void Start()
 {
     stateMachine = GetComponent<FiniteStateMachine>();
     stateMachine.InitializeStateMachine();
     stateMachine.AddState(new GunnerReachedScreenEdge(this.transform));
     stateMachine.AddState(new GunnerAttackingPlayer(this.transform));
     stateMachine.AddState(new GunnerMovingToPosition(this.transform));
     stateMachine.AddState(new GunnerInFormation(this.transform));
     stateMachine.AddState(new GunnerDead(this.transform));
 }
开发者ID:Broghain,项目名称:GTO7,代码行数:11,代码来源:GunnerController.cs

示例4: Awake

	protected void Awake() {
		_fsm = new FiniteStateMachine();

		_fsm.AddState(new GameCreateState());
		_fsm.AddState(new GameResetState());
		_fsm.AddState(new GamePlayState());
		_fsm.AddState(new GameWinState());
		_fsm.AddState(new GameLoseState());

		_fsm.ChangeState(new FSMTransition(GameState.GameCreate));
	}
开发者ID:jtuttle,项目名称:ritual,代码行数:11,代码来源:GameController.cs

示例5: Start

    // Use this for initialization
    void Start()
    {
        transform.rotation = Quaternion.LookRotation(GameManager.instance.GetPlayer().position - transform.position, new Vector3(0, 0, -1));

        stateMachine = GetComponent<FiniteStateMachine>();
        stateMachine.InitializeStateMachine();
        stateMachine.AddState(new FighterAttackingPlayer(transform, gameMng.GetPlayer()));
        stateMachine.AddState(new FighterReachedScreenEdge(transform, gameMng.GetPlayer()));
        stateMachine.AddState(new FighterDead(transform));

        partners = new FighterController[2];
    }
开发者ID:Broghain,项目名称:GTO7,代码行数:13,代码来源:FighterController.cs

示例6: AIProperty

        public AIProperty()
        {
            IsActive = true;
            StateMachine = new FiniteStateMachine();

            // basic behaviors!
            StateMachine.AddState("idle", 2, 3);
            StateMachine.AddState("move", 2, 2);
            StateMachine.AddTransition("idle", "move", .5);
            StateMachine.AddTransition("move", "idle", .5);

               	    // Pick our first state.
            StateMachine.SetState("idle");
        }
开发者ID:gbarnes12,项目名称:atlantis-xna,代码行数:14,代码来源:AIProperty.cs

示例7: Awake

    protected void Awake()
    {
        _fsm = new FiniteStateMachine();

        _fsm.AddState(new MonsterWanderState(gameObject));

        _fsm.ChangeState(new FSMTransition(MonsterState.Wander));
    }
开发者ID:jtuttle,项目名称:umbra-client,代码行数:8,代码来源:MonsterAI.cs

示例8: Start

    void Start()
    {
        _myTransform = transform;

        Text.renderer.enabled = false;

        _fsm = new FiniteStateMachine("start state", StartState);
        _fsm.AddState("say hello", SayHello);

        _fsm.AddEvent("go and say hello", "start state", "say hello");
        _fsm.AddEvent("say goodbye and go away", "say hello", "start state");

        _fsm.AddTransition("start state", "say hello",  ()=> MoveTo(Target));
        _fsm.AddTransition("say hello",  "start state", ()=> MoveTo(End));
    }
开发者ID:IslamovDenis,项目名称:Csharp-FSM-,代码行数:15,代码来源:FSMCube.cs

示例9: InitializeStateMachine

    protected virtual void InitializeStateMachine()
    {
        Idle idleState = new Idle(this);
        idleState.AddTransition(Transition.E_FAILGESTURE, StateID.E_ATTACK);
        idleState.AddTransition(Transition.E_LOSTHP, StateID.E_DAMAGED);
        idleState.AddTransition(Transition.E_NOHP, StateID.E_DEATH);

        Attack atkState = new Attack(this);
        atkState.AddTransition(Transition.E_FINISHATTACK, StateID.E_IDLE);
        atkState.AddTransition(Transition.E_LOSTHP, StateID.E_DAMAGED);

        Damaged dmgState = new Damaged(this);
        dmgState.AddTransition(Transition.E_NOHP, StateID.E_DEATH);
        dmgState.AddTransition(Transition.E_FINISHATTACK, StateID.E_IDLE);
        dmgState.AddTransition(Transition.E_LOSTHP, StateID.E_DAMAGED);

        Death deathState = new Death(this);
        enemyState = new FiniteStateMachine();
        enemyState.AddState(idleState);

        enemyState.AddState(atkState);
        enemyState.AddState(dmgState);
        enemyState.AddState(deathState);
    }
开发者ID:kreeds,项目名称:TestProjectDemo,代码行数:24,代码来源:Enemy.cs

示例10: MakeFSM

    protected override void MakeFSM()
    {
        base.MakeFSM();

        EnemyRandomWalk randomWalk = new EnemyRandomWalk(StateID.RandomWalk, this);
        randomWalk.AddTransition(Transition.FoundBreadcrumb, StateID.BreadcrumbWalk);
        randomWalk.AddTransition(Transition.FoundPlayer, StateID.Finished);

        EnemyBreadcrumbWalk breadcrumbWalk = new EnemyBreadcrumbWalk(StateID.BreadcrumbWalk, this);
        breadcrumbWalk.AddTransition(Transition.LostBreadcrumb, StateID.RandomWalk);
        breadcrumbWalk.AddTransition(Transition.FoundPlayer, StateID.Finished);

        PlayerFinished finished = new PlayerFinished(StateID.Finished, this.gameObject);

        fsm = new FiniteStateMachine();
        fsm.AddState(randomWalk);
        fsm.AddState(breadcrumbWalk);
        fsm.AddState(finished);
    }
开发者ID:Parzival42,项目名称:Bread,代码行数:19,代码来源:NPCBreadcrumb.cs


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