Exemple #1
0
    public override void FSM_SetUp()
    {
        this.myTarget = null;

        BuildingState_IDLE buildingIDLE = new BuildingState_IDLE(this);

        buildingIDLE.AddTransition(Transition.IdleToSearch, StateID.SEARCH);

        BuildingState_TargetFind buildingSEARCH = new BuildingState_TargetFind(this);

        buildingSEARCH.AddTransition(Transition.SearchToAttack, StateID.ATTACK);
        buildingSEARCH.AddTransition(Transition.SearchToIdle, StateID.IDLE); //if die.

        BuildingState_Attack buildingATTACK = new BuildingState_Attack(this);

        buildingATTACK.AddTransition(Transition.AttackToSearch, StateID.SEARCH);
        buildingATTACK.AddTransition(Transition.AttackToIdle, StateID.IDLE); //if die.

        fsm = new FSMSystem();
        fsm.CreateStates();
        fsm.AddState(buildingIDLE);
        fsm.AddState(buildingSEARCH);
        fsm.AddState(buildingATTACK);
    }
    public override void FSMSetup()
    {
        this.myTarget = null;

        BuildingState_IDLE state_IDLE = new BuildingState_IDLE(this);

        state_IDLE.AddTransition(Transition.IdleToSearch, StateID.SEARCH);

        BuildingState_TargetFind state_TargetFind = new BuildingState_TargetFind(this);

        state_TargetFind.AddTransition(Transition.SearchToAttack, StateID.ATTACK);
        state_TargetFind.AddTransition(Transition.SearchToIdle, StateID.IDLE);

        BuildingState_Attack state_Attack = new BuildingState_Attack(this);

        state_Attack.AddTransition(Transition.AttackToSearch, StateID.SEARCH);
        state_Attack.AddTransition(Transition.AttackToIdle, StateID.IDLE);

        Fsm = new FSMSystem();
        Fsm.CreateStates();
        Fsm.AddState(state_IDLE);
        Fsm.AddState(state_TargetFind);
        Fsm.AddState(state_Attack);
    }