// Use this for initialization void Start() { ProceduralWorldCreator worldCreator = GetComponent <ProceduralWorldCreator>(); CloudSpawner cloudSpawner = GetComponent <CloudSpawner>(); MountainSpawner spawner = GetComponent <MountainSpawner>(); LevelParameters level = levels[levelNumber]; worldCreator.minNumContinents = level.minNumContinents; worldCreator.maxNumContinents = level.maxNumContinents; cloudSpawner.minCloudCount = level.minNumClouds; cloudSpawner.maxCloudCount = level.maxNumClouds; spawner.minSpawnTime = level.minMountainSpawnRate; spawner.maxSpawnTime = level.maxMountainSpawnRate; numLevels = 3; //levels.Length; }
private void Start() { fadeTexts = FindObjectsOfType <FadeText>(); highScoreText = FindObjectOfType <HighScoreText>(); spawners = FindObjectsOfType <Spawner>(); currentBird = FindObjectOfType <Bird>(); audioPlayer = FindObjectOfType <AudioPlayer>(); groundSpawner = GameObject.Find("Ground Spawner").GetComponent <MountainSpawner>(); if (!currentBird) { currentBird = Instantiate(birdPrefab); } windPlayer = FindObjectOfType <WindPlayer>(); realScrollSpeedIncreaseRate = -scrollSpeedIncreaseRate / 1000; scrollSpeed = -startingScrollSpeed; }
void Boom() { // Fix our angle and stop moving rigidbody2D.velocity = Vector2.zero; rigidbody2D.fixedAngle = true; rigidbody2D.isKinematic = true; // Explode ourselves animator.SetBool("Exploded", true); // Set spawner to stop spawning GameObject[] spawners = GameObject.FindGameObjectsWithTag("Respawn"); for (int i = 0; i < spawners.Length; i++) { ObstacleSpawner os = spawners[i].GetComponent <ObstacleSpawner>(); if (os != null) { os.IsSpawning = false; } MountainSpawner ms = spawners[i].GetComponent <MountainSpawner>(); if (ms != null) { ms.IsSpawning = false; } } // Stop moving Obstacles GameObject[] Obstacles = GameObject.FindGameObjectsWithTag("Obstacle"); for (int i = 0; i < Obstacles.Length; i++) { ObstacleBehavior ob = Obstacles[i].GetComponent <ObstacleBehavior>(); if (ob != null) { ob.speed = 0; } } // Set ourselves as exploded hasExploded = true; // Stop clouds GameObject particles = GameObject.FindGameObjectWithTag("Particles"); if (particles != null) { particles.GetComponent <ParticleSystem>().Pause(); } // Stop mountains GameObject[] Mountains = GameObject.FindGameObjectsWithTag("Mountains"); for (int i = 0; i < Mountains.Length; i++) { MountainBehavior ob = Mountains[i].GetComponent <MountainBehavior>(); if (ob != null) { ob.BaseSpeed = 0; } } // Stop Music GameObject music = GameObject.FindGameObjectWithTag("Music"); if (music != null) { music.GetComponent <AudioSource>().Stop(); Destroy(music); } // Flash the screen flasher.StartFlash(); // Play Explosion Sound audio.clip = explode; audio.Play(); // Show menu GameObject.FindGameObjectWithTag("RestartMenu").GetComponent <RestartMenu>().Show(); }
// Start is called before the first frame update public void SetMountainSpawner(MountainSpawner newMountainSpawner) { mountainSpawner = newMountainSpawner; }