/// <summary> /// Destroies the ship /// </summary> public override void Destroy() { CoinController.SpawnCoin(this.transform.position); EnemyController.RecycleEnemy(gameObject); GameManager.Instance.AddScore(10); GameManager.Instance.UpdateEnemiesKilled(); }
/// <summary> /// Spawn coin after ship destroied /// </summary> /// <param name="position"> Ship Position </param> public static void SpawnCoin(Vector3 position) { GameObject coin = CoinController.GetCoin(); coin.SetActive(true); coin.transform.parent = null; coin.transform.position = position; coin.GetComponent <Coin>().Init(); }
/// <summary> /// Put back to the object pool /// </summary> void Recycle() { CoinController.Recycle(gameObject); }