Ejemplo n.º 1
0
    private void GenerateContent(GlobalWarning.warningType warnType)
    {
        textContent = GetComponentInChildren<Text>();
        mainType = warnType;
        critter = FindObjectOfType<Player>().GetCritter();

        string text = "";

        if (warnType == GlobalWarning.warningType.EVENT)
        {
            float val = habitat.GetRiskFactor() * 100;

            if (val != 0) { text = "DANGER: " + val + "%"; }
            else { text = "NO DANGER"; }
        }
        else if (warnType == GlobalWarning.warningType.FOOD)
        {
            Critter.dietType target = critter.GetWeakestDiet(habitat);
            float val = habitat.GetFoodHealth(target);

            text = "FOOD AVAILABILITY: " + Hex.GetFoodHealthString(val);
        }
        else if (warnType == GlobalWarning.warningType.LOCO)
        {
            text = "CAN'T SURVIVE:  ";
        }
        else if (warnType == GlobalWarning.warningType.POP)
        {
            text = UpdatePOP();
        }
        else if (warnType == GlobalWarning.warningType.RESTRICT)
        {
            text = "RESTRICTIONS: ";
        }
        else if (warnType == GlobalWarning.warningType.SCORE)
        {
            float val = critter.CritterSurvivalCheck(habitat);

            text = "HABITABILITY: " + Critter.GetSurvivalChanceString(val);
        }

            textContent.text = text;
    }