예제 #1
0
    // Update is called once per frame
    void Update()
    {
        GRATE = GrowthRate();

        CauseDeath cd = CauseDeath.None;

        if (water <= waterLowDead)
        {
            cd = CauseDeath.WaterLow;
        }
        else if (water >= waterHighDeath)
        {
            cd = CauseDeath.Waterhigh;
        }
        else if (temp >= tempHighDead)
        {
            cd = CauseDeath.TempHigh;
        }
        else if (temp <= tempLowDead)
        {
            cd = CauseDeath.TempLow;
        }

        if (cd != CauseDeath.None)
        {
            Die(cd);
        }

        Grow(growth * GrowthRate() * Time.deltaTime, waterBaseConsumption * Time.deltaTime);
        if (temp >= 0)
        {
            water -= tempWaterUsagePerDeg * Time.deltaTime * temp;
        }
    }
예제 #2
0
 void Die(CauseDeath cd)
 {
     if (dataProvider == null)
     {
         return;
     }
     dataProvider.GetComponent <DataProvider>().cause = cd;
     UnityEngine.SceneManagement.SceneManager.LoadScene("GameOver");
 }