Exemplo n.º 1
0
    public void setTurn(PlayerType newPlayer)
    {
        //For a GS turn
        if (newPlayer == PlayerType.GS)
        {
            playerTurn = PlayerType.GS;
            if (thisPlayer == PlayerType.GS)
            {
                resetAP(PlayerType.GS);
                if (blipsPerTurn > 0)
                {
                    changeGameState(GameState.DeploymentPhase);
                    deployment();
                }
                else
                {
                    changeGameState(GameState.RevealPhase);
                    revealPhase();
                }
            }
            else
            {
                changeGameState(GameState.NetworkWait);
                if (gameIsMultiplayer)
                {
                    //Send to the network
                }
                else
                {
                    resetAP(PlayerType.GS);
                    algorithm.AITurn();
                }
            }
        }
        //For an SM turn
        else
        {
            //Set the player turn
            playerTurn = PlayerType.SM;
            if (thisPlayer == PlayerType.SM)
            {
                resetAP(PlayerType.SM);

                //Reselect the currently selected unit
                //and change the Game State.
                if (unitSelected)
                {
                    changeGameState(GameState.InactiveSelected);
                }
                else
                {
                    changeGameState(GameState.Inactive);
                }
                //Set the player CP
                remainingCP = Random.Range(1, 7);
                if (gameIsMultiplayer)
                {
                    //Send to Network
                }
            }
            //If this is the genestealer player
            else
            {
                changeGameState(GameState.NetworkWait);

                //Update the display
            }
            //Unjam all the Space Marines
            foreach (Unit spaceMarine in gameMap.getUnits(EntityType.SM))
            {
                spaceMarine.isJammed      = false;
                spaceMarine.isOnOverwatch = false;
            }
            ioModule.removeJam();
            ioModule.removeOverwatch();
        }


        //Reselect the unit to match the new gameState
        if (unitSelected)
        {
            selectUnit(selectedUnit.gameObject);
        }
    }