/// <summary> /// Восстанавливаем условия по умолчанию /// </summary> public void Reset() { foreach (GameObject sphere in Spheres) { Destroy(sphere); } Spheres.Clear(); audio.clip = LoadingManager.MarioTheme; audio.Stop(); GradientGenerator.GenereteTextures(); lastGenTime = 0f; GameTime = 0f; Points = 0; SpeedMultiplier = 1f; spheresMaxCount = 5; }
/// <summary> /// Считаем время, увеличиваем сложность, продолжаем генерировать сферы... /// </summary> void Update() { if (!audio.isPlaying) { audio.Play(); } int difficulty = (int)GameTime / 30; GameTime += Time.deltaTime; if ((int)GameTime / 30 != difficulty) { GradientGenerator.GenereteTextures(); spheresMaxCount++; SpeedMultiplier += 1 / 3f; } if (GameTime - lastGenTime > spawnDelay && Spheres.Count < spheresMaxCount) { GenerateSphere(); } }