Beispiel #1
0
    public void NotifyPlayerSelectedAction(PlayerSelectedAction action)
    {
        CustomUnit currentUnit = _currentPlayer.CurrentUnit as CustomUnit;

        if (currentUnit.isActing || currentUnit.isAnimating)
        {
            Debug.Log("Cannot do actions while the unit is acting");
            return;
        }

        switch (action)
        {
        case PlayerSelectedAction.MOVE:
            if (currentUnit != null && currentUnit.MovementPoints > 0)
            {
                _cellGrid.CellGridState = new CellGridStateUnitMove(_cellGrid, currentUnit);
            }
            break;

        case PlayerSelectedAction.ATTACK:
            if (currentUnit != null && currentUnit.ActionPoints > 0 && currentUnit.abilityActionUsable)
            {
                _cellGrid.CellGridState = new CellGridStateUnitAttack(_cellGrid, currentUnit);
            }
            break;

        case PlayerSelectedAction.ABILITY:
            if (currentUnit != null && currentUnit.ActionPoints > 0 && currentUnit.abilityActionUsable)
            {
                currentUnit.ability.EnterState(_cellGrid, currentUnit);
            }
            break;

        case PlayerSelectedAction.SKIPTURN:
            _cellGrid.EndTurn();
            break;

        case PlayerSelectedAction.PAUSE:
            _pauseMenu.ToglePause(true);
            break;

        default:
            Debug.Assert(false, "Option not implemented detected");
            break;
        }
    }