Exemple #1
0
    void Update()
    {
        if (SecondScore < Time.time && AssistantBehaviour.Tutorial == false)
        {
            ScoreManaging.AddScore(1);
            SecondScore = Time.time + 1;
        }
        if (ProgressBar.fillAmount < 0.60f)
        {
            Bar.color = Stage01;
        }
        if (ProgressBar.fillAmount > 0.60f && ProgressBar.fillAmount < 0.75f)
        {
            Bar.color = Stage02;
        }
        if (ProgressBar.fillAmount > 0.75f)
        {
            Bar.color = Stage03;
        }

        if (DEVSWITCH == false)
        {
            ProgressBar.fillAmount = ProgressPool;
            if (ProgressPool >= 1)
            {
                DestoryDisasters();
                ShakeBehaviour.StopShake();
                PlayerWin      = false;
                GameEnd        = true;
                Time.timeScale = 0;
                StartCoroutine(switchScene());
            }
            if (ProgressPool < 0)
            {
                DestoryDisasters();
                ShakeBehaviour.StopShake();
                if (added == false)
                {
                    ScoreManaging.AddScore(5000);
                    added = true;
                }
                PlayerWin      = true;
                GameEnd        = true;
                Time.timeScale = 0;
                StartCoroutine(switchScene());
            }
        }
    }
 private void AliveUpdate()
 {
     if (CurrentHealth <= 0)                                                                                                          //om stadens health är mindre eller likamed 0 byt till död
     {
         if (AssistantBehaviour.Tutorial == false)
         {
             if (CurrentLevel == 1)
             {
                 if (EndGame.CommenceTheEndGaame == false)
                 {
                     if (CitiesAlive.CitiesAlive > 8)
                     {
                         AddToScore         = 75;
                         Pool.ProgressPool -= 0.033f;
                     }
                     else
                     {
                         AddToScore         = 50;
                         Pool.ProgressPool -= 0.037f;
                     }
                 }
                 else
                 {
                     Pool.ProgressPool -= 0.1f;
                 }
             }
             else if (CurrentLevel == 2)
             {
                 if (EndGame.CommenceTheEndGaame == false)
                 {
                     if (CitiesAlive.CitiesAlive > 8)
                     {
                         AddToScore         = 150;
                         Pool.ProgressPool -= 0.045f;
                     }
                     else
                     {
                         AddToScore         = 100;
                         Pool.ProgressPool -= 0.065f;
                     }
                 }
                 else
                 {
                     Pool.ProgressPool -= 0.125f;
                 }
             }
             else if (CurrentLevel == 3)
             {
                 if (EndGame.CommenceTheEndGaame == false)
                 {
                     if (CitiesAlive.CitiesAlive > 8)
                     {
                         AddToScore         = 300;
                         Pool.ProgressPool -= 0.1f;
                     }
                     else
                     {
                         AddToScore         = 200;
                         Pool.ProgressPool -= 0.114f;
                     }
                 }
                 else
                 {
                     Pool.ProgressPool -= 0.15f;
                 }
             }
         }
         ScoreManaging.AddScore(AddToScore);
         citySoundPlayer.clip = citySoundClips[1];
         citySoundPlayer.Play();
         SwitchState();
         CitiesAlive.CitiesAlive--;
         return;
     }
     UpgradeCity();                                                                                                                  //callar funktionen upgradecity
 }