//detects collisions //if it's the goal, proceed to the next level, otherwise restart the level public void OnCollisionEnter2D(Collision2D collision) { Planetary planet = collision.gameObject.GetComponent <Planetary> (); if (planet.goal) { Debug.Log("VICTORY"); Application.LoadLevel(Application.loadedLevel + 1); } else { if (active || planet.iminent) { Debug.Log("FAILURE"); Application.LoadLevel(Application.loadedLevelName); } } }
private void Update() { switch (GameState.Get.CurrentMode) { case GameState.Mode.Planetary: Planetary.MakeRotation(); break; case GameState.Mode.Interplanetary: Interplanetary.MakeMovement(); break; default: throw new ArgumentOutOfRangeException(); } #if UNITY_EDITOR UpdatePlanetaryParameters(); UpdateInterplanetaryParameters(); #endif }