コード例 #1
0
    private IEnumerator TargetPainted(float secondsToWait)
    {
        throwing = false;
        targetNoSpawned++;
        if (targetNoSpawned < targetNoForThisLevel)
        {
            bulletsShot = 0; partsPainted = partsCount;
            InstantiateNewTargetForCurrentLevel();
            StopAllCoroutines(); // return;
        }
        else
        {
            print("level complete\nreload scene"); // check other lines


            //PlayerPrefs.SetInt("partAnimationNo", partAnimationNo);
            //PlayerPrefs.Save();
            //print("last part anim no: "+PlayerPrefs.GetInt("partAnimationNo"));

            //int particles = PlayerPrefs.GetInt("backParticles", 0);
            //if (particles + 1 >= backgroundParticles.transform.childCount)
            //    PlayerPrefs.SetInt("backParticles", 0);
            //else PlayerPrefs.SetInt("backParticles", particles + 1);

            PlayerPrefs.SetInt("chooseNew", 0);
            PlayerPrefs.SetInt("target", targetInstantiated + 1);
            if (PlayerPrefs.GetInt("lastEnemy", 0) < enemies.Length - 1)
            {
                PlayerPrefs.SetInt("lastEnemy", lastEnemy);
            }
            PlayerPrefs.SetInt("tmpGamesPlayed", tmpGamesPlayed);
            ui.GoingToNextLevel();
            ui.ActivateLevelCompleteUi(true);
            //REPLACE WITH GameOverAnim, which at end calls Restart():
            PlayerPrefs.Save();
            yield return(new WaitForSeconds(3));

            //Restart();
        }
    }