Exemplo n.º 1
0
    public void SetMoveState()
    {
        FSMSystem.AddState(this, new State(STATE.Move, this,
                                           () =>//on enter move state
        {
            currentStateDebug.text = STATE.Move.ToString();
            DisableShaderAttackCells();
            _pathfindingGrid.UpdateGrid(this);
            GetCellsPossibleMovements();
        },
                                           () =>
        {
            DisableShaderMoveCells();
            Debug.Log("hacemos el onexit");
            possibleMovements.Clear();
            _pathfindingGrid.UpdateGrid(this);
        })
                           );

        List <Action> behavioursMoveState = new List <Action>()
        {
            GetComponent <Move>()
        };

        FSMSystem.AddBehaviours(this, behavioursMoveState, states.Find((x) => x.stateName == STATE.Move));
    }
Exemplo n.º 2
0
    private void SetAttackState()
    {
        FSMSystem.AddState(this, new State(STATE.Attack, this,
                                           () => {
            currentStateDebug.text = STATE.Attack.ToString();
            _pathfindingGrid.UpdateGrid(this);
            GetCellsWithEnemiesInRange();
        },
                                           () => {
            possibleAttacks.Clear();
            _pathfindingGrid.UpdateGrid(this);
        })
                           );

        List <Action> behavioursAttackState = new List <Action>()
        {
            GetComponent <Attack>()
        };

        FSMSystem.AddBehaviours(this, behavioursAttackState, states.Find((x) => x.stateName == STATE.Attack));
    }