void GeneratePlanets() { if (planets != null) { foreach (Planet p in planets) { Destroy(p.gameObject); } planets.Clear(); } PlanetGenerator generator = new PlanetGenerator(); planets = generator.GeneratePlanets(startMesh, amountOfPlanets, radius, noiseIntensity, noiseSmoothing, LOD); planets [0].Initialize(Vector3.zero, 20, 0); for (int i = 1; i < planets.Count; i++) { Planet p = planets [i]; //float speed = Random.Range (10, 20); Vector3 direction = (planets [0].transform.position - p.transform.position).normalized; Vector3 velocity = Quaternion.AngleAxis(90, Vector3.up) * direction /** speed*/; planets [i].Initialize(velocity, Random.Range(1, 5), i); } }
public static void StartGame(GameState providedGameState = default) { var effectiveGameState = providedGameState; if (effectiveGameState == default) { effectiveGameState = new GameState(); effectiveGameState.ConsumptionRates = consumptionRates; effectiveGameState.Ship = ShipGenerator.GenerateShip(ShipGenerator.ShipTypes[0]); //{ // ConsumptionRates = consumptionRates, // Ship = ShipGenerator.GenerateShip(ShipGenerator.ShipTypes[0]), // Options = new GameStateOptions() // { // AreAnimationsEnabled = true, // BackgroundVolume = 0.125f // } //}; effectiveGameState.Planets.AddRange(PlanetGenerator.GeneratePlanets(4)); effectiveGameState.CurrentScene = SceneNames.Far; } GameState = effectiveGameState; ChangeScene(effectiveGameState.CurrentScene); }
void GeneratePlanets () { if (planets != null) { foreach (Planet p in planets) { Destroy (p.gameObject); } planets.Clear (); } PlanetGenerator generator = new PlanetGenerator (); planets = generator.GeneratePlanets (startMesh, amountOfPlanets, radius, noiseIntensity, noiseSmoothing, LOD); planets [0].Initialize (Vector3.zero, 20, 0); for (int i = 1; i < planets.Count; i++) { Planet p = planets [i]; //float speed = Random.Range (10, 20); Vector3 direction = (planets [0].transform.position - p.transform.position).normalized; Vector3 velocity = Quaternion.AngleAxis (90, Vector3.up) * direction /** speed*/; planets [i].Initialize (velocity, Random.Range (1, 5), i); } }
public void FlyAway() { Core.GameState.PlanetsVisited++; Core.GameState.Planets.Clear(); Core.GameState.Planets.AddRange(PlanetGenerator.GeneratePlanets(4)); Core.BackgroundMusicManager.Mute(); if (Core.Options.AreAnimationsEnabled) { var clip = Core.ResourceCache.GetAudioClip(Path.Combine("Audio", "Effects", "FlyOff-Short")); AudioSource.clip = clip; AudioSource.Play(); this.isFlyingOff = true; StartCoroutine(AudioSource.WaitForSound(FinishedFlyOff)); } else { this.ChangeScene(); } }