void setActiftARandomDisaster()
    {
        int randomDisaster = Random.Range(1, System.Enum.GetNames(typeof(EnumDisasterTypes_Aure)).Length);

        my_disasters[randomDisaster].gameObject.SetActive(true);
        cityScript.Set_food(cityScript.Get_food() - (my_disasters[randomDisaster].GetPercentLostFood() * cityScript.Get_food()));
        cityScript.Set_people(cityScript.Get_people() - (my_disasters[randomDisaster].GetPercentLostInhabitants() * cityScript.Get_people()));
        cityScript.Set_souls(cityScript.Get_souls() - (my_disasters[randomDisaster].GetPercentLostSouls() * cityScript.Get_souls()));
    }
示例#2
0
    void setActifARandomDisaster()
    {
        int enumLenght     = System.Enum.GetValues(typeof(EnumDisasterTypes_Aure.DisasterType)).Length;
        int randomDisaster = Random.Range(0, enumLenght);

        cityScript.Set_food(cityScript.Get_food() - (int)(my_disasters[randomDisaster].GetComponent <Disaster_Aure>().GetPercentLostFood() * cityScript.Get_food()));
        cityScript.Set_people(cityScript.Get_people() - (int)(my_disasters[randomDisaster].GetComponent <Disaster_Aure>().GetPercentLostInhabitants() * cityScript.Get_people()));
        cityScript.Set_souls(cityScript.Get_souls() - (int)(my_disasters[randomDisaster].GetComponent <Disaster_Aure>().GetPercentLostSouls() * cityScript.Get_souls()));
        my_disasters[randomDisaster].SetActive(true);
        my_disasters[randomDisaster].transform.GetChild(0).gameObject.GetComponent <TextMeshProUGUI>().text =
            "- " + (int)(my_disasters[randomDisaster].GetComponent <Disaster_Aure>().GetPercentLostFood() * cityScript.Get_food()) +
            " nourritures \n" +
            "- " + (int)(my_disasters[randomDisaster].GetComponent <Disaster_Aure>().GetPercentLostSouls() * cityScript.Get_souls()) +
            " habitants";
        PutGameInPause(true);
    }