Exemple #1
0
    //buffer function for select when the selection is initiated by player, check turn mode condition before proceed
    public void ManualSelect()
    {
        //if not in target select phase for unitAbility
        if (!GridManager.IsInTargetTileSelectMode())
        {
            if (!GameControlTB.AllowUnitSwitching())
            {
                //Debug.Log("unit swtiching is lock");
                return;
            }

            _MoveOrder moveOrder = GameControlTB.GetMoveOrder();

            //if turn mode and turnOrder doesnt not support unit switching, return
            if (moveOrder != _MoveOrder.Free)
            {
                return;
            }

            _TurnMode turnMode = GameControlTB.GetTurnMode();
            if (turnMode == _TurnMode.FactionSingleUnitPerTurnAll)
            {
                if (unit.MovedForTheRound())
                {
                    Debug.Log("unit has been moved");
                    return;
                }
            }
            else if (turnMode == _TurnMode.SingleUnitPerTurn)
            {
                //Debug.Log("turn mode not allow switching");
                return;
            }
        }
        Select();
    }