private void CreateAsteroidGenerator(LaunchValues launchValues) { GameObject newAsteroidGenerator = Instantiate(this.asteroidGeneratorPrefab, launchValues.startPoint, new Quaternion()) as GameObject; AsteroidGenerator generator = newAsteroidGenerator.GetComponent <AsteroidGenerator>(); generator.SetupAsteroidGenerator(launchValues); }
public void SetupAsteroid(LaunchValues launchValues) { Vector2 initialVelocity = launchValues.curDirection * launchValues.rawMagnitude; this.rigidBody.velocity = initialVelocity; GameManager.OnRestartButtonClicked += this.DestroyAsteroid; }
public void SetupAsteroidGenerator(LaunchValues launchValues) { this.launchValues = launchValues; this.launchAsteroid = AsteroidSelector.selectedAsteroid; Note asteroidNote = this.launchAsteroid.GetComponentInChildren <Note>(); this.phrase = new Phrase(asteroidNote.phraseNumber, asteroidNote.beatsPerPhrase); Metronome.OnStep += this.LaunchAsteroid; GameManager.OnRestartButtonClicked += this.DestroyAsteroidGenerator; }