示例#1
0
    private void decreaseUpgrade(ForecastHandler.Forecast type)
    {
        switch (type)
        {
        case ForecastHandler.Forecast.Cold:
            PlantationManager.plantations[GameMaster.GM.plantationManager.currentPlant].decreaseColdResistance();
            break;

        case ForecastHandler.Forecast.Heat:
            PlantationManager.plantations[GameMaster.GM.plantationManager.currentPlant].decreaseHeatResistance();
            break;

        case ForecastHandler.Forecast.Flood:
            PlantationManager.plantations[GameMaster.GM.plantationManager.currentPlant].decreaseFloodResistance();
            break;

        case ForecastHandler.Forecast.Pest:
            PlantationManager.plantations[GameMaster.GM.plantationManager.currentPlant].decreasePestResistance();
            break;

        case ForecastHandler.Forecast.Drought:
            PlantationManager.plantations[GameMaster.GM.plantationManager.currentPlant].decreaseDroughtResistance();
            break;
        }
    }
示例#2
0
    // Start is called before the first frame update
    void Start()
    {
        int children = transform.childCount;
        List <ForecastHandler.Forecast> usedForecast = new List <ForecastHandler.Forecast>();

        usedForecast.Add(GameMaster.GM.displayUpgrades.forecast);
        for (int i = 0; i < children; ++i)
        {
            ForecastHandler.Forecast secondType = ForecastHandler.Forecast.Cold;
            foreach (ForecastHandler.Forecast forecast in System.Enum.GetValues(typeof(ForecastHandler.Forecast)))
            {
                if (!usedForecast.Contains(forecast))
                {
                    secondType = forecast;
                    usedForecast.Add(forecast);
                    break;
                }
            }
            DnaUpgrade upgrade = transform.GetChild(i).GetComponent <DnaUpgrade>();
            upgrade.upgradeText(GameMaster.GM.displayUpgrades.forecast, secondType, i == 0);
            if (PlantationManager.plantations[GameMaster.GM.plantationManager.currentPlant].hasUpgrade(upgrade))
            {
                upgrade.transform.GetChild(3).GetComponent <Button>().interactable = false;
            }
        }
    }
示例#3
0
 public void upgradeText(ForecastHandler.Forecast type1, ForecastHandler.Forecast type2, bool sign)
 {
     this.type1 = type1;
     this.type2 = type2;
     positive   = sign;
     transform.GetChild(2).GetComponent <Text>().text = type1.ToString() + System.Environment.NewLine + type2.ToString();
 }
 public void LoadUpgrades(ForecastHandler.Forecast type)
 {
 }