Exemplo n.º 1
0
    public void UpdateSliders(int die1, int die2, int die3, int radiationBonus, int fuelBonus)
    {
        int currentRadiation = 0;
        int totalRadiation   = 0;
        int fuel             = 0;

        int[] dice = { die1, die2, die3 };

        for (int i = 0; i < 3; i++)
        {
            currentRadiation += diceHandler.GetRadiation(dice[i]);
            fuel             += diceHandler.GetFuel(dice[i]);
        }

        if (currentRadiation > 0)
        {
            if (stateHandler.currentPlayer == 0)
            {
                UpdatePlayerRadiation(currentRadiation + radiationBonus);
                totalRadiation = (int)playerRadiationSlider.value;
            }
            else
            {
                UpdateComputerRadiation(currentRadiation + radiationBonus);
                totalRadiation = (int)computerRadiationSlider.value;
            }
        }

        if (fuel > 0)
        {
            stateHandler.currentFuelForTurn += fuel + fuelBonus;

            if (stateHandler.currentPlayer == 0)
            {
                UpdatePlayerFuel(fuel + fuelBonus);
            }
            else
            {
                UpdateComputerFuel(fuel + fuelBonus);
            }

            stateHandler.CheckForGameOver();
        }

        stateHandler.CheckForMaxRadiation(totalRadiation);
    }