Ejemplo n.º 1
0
    void Start()
    {
        animator = GetComponent <SimpleSpriteAnimator>();
        fsm      = new SimpleAnimFSM();

        //Add our triggers to the FSM.
        fsm.AddTrigger(Warrior.Keywords.deathTrigger);
        fsm.AddTrigger(Warrior.Keywords.attackTrigger);
        fsm.AddTrigger(Warrior.Keywords.respawnTrigger);

        //Add our persistent variables to the FSM.
        fsm.AddVar(Warrior.Keywords.canMove, true);
        fsm.AddVar(Warrior.Keywords.moveInput, false);

        //TODO: Add states to FSM.
    }
    void Start()
    {
        animator = GetComponent <SimpleSpriteAnimator>();
        fsm      = new SimpleAnimFSM();

        //Add our triggers to the FSM.
        fsm.AddTrigger(Warrior.Keywords.deathTrigger);
        fsm.AddTrigger(Warrior.Keywords.attackTrigger);
        fsm.AddTrigger(Warrior.Keywords.respawnTrigger);

        //Add our persistent variables to the FSM.
        fsm.AddVar(Warrior.Keywords.canMove, true);
        fsm.AddVar(Warrior.Keywords.moveInput, false);

        //Add states to the FSM.
        fsm.AddState(StateID.IDLE_STATE, new IdleState_COMPLETED(idleID, animator, fsm));
        fsm.AddState(StateID.WALK_STATE, new WalkState_COMPLETED(walkID, animator, fsm));
        fsm.AddState(StateID.ATTACK_STATE, new AttackState_COMPLETED(attackID, animator, fsm));
        fsm.AddState(StateID.DIE_STATE, new DieState_COMPLETED(deathID, animator, fsm));

        //Initialize FSM state.
        fsm.SetState(StateID.IDLE_STATE);
    }