public override void OnTriggerEnter2D(Collider2D col) { int score = 0; if (col.gameObject.tag == ObjectMap.EatTag) { score = col.gameObject.GetComponent <Enemy>().Mass; Mass += score; float mathfPow = Mathf.Pow(Scale, 2.0f) + 5.0f; FoodExplosion.GetComponent <Transform>().localScale = new Vector3(mathfPow, mathfPow, mathfPow); if (CurrentExplosions < MaxExplosions) { CurrentExplosions++; Instantiate(FoodExplosion, col.gameObject.transform.position, new Quaternion()); } col.gameObject.transform.position = new Vector2(UnityEngine.Random.Range(-500.0f, 500.0f), UnityEngine.Random.Range(-500.0f, 500.0f)); FloatingTextController.CreateFloatingText("+" + score.ToString()); Controller.gameManager.GetComponent <PlanetSoundsController>().EatSound(); } else { score = (int)col.gameObject.GetComponent <BotPlanet>().Mass; int targetLevel = col.gameObject.GetComponent <BotPlanet>().Level; int myLevel = Level; if (targetLevel < myLevel) { Controller.gameManager.GetComponent <PlanetSoundsController>().KillPlanetSound(); Mass += score; Controller.PlanetsKilled++; float mathfPow = Mathf.Pow(col.gameObject.GetComponent <BotPlanet>().Scale, 2.0f) + 10; Vector3 planetDestroyScale = new Vector3(mathfPow, mathfPow, mathfPow); _planetDestroyAnim.GetComponent <Transform>().localScale = planetDestroyScale; Instantiate(_planetDestroyAnim, col.gameObject.transform.position, new Quaternion()); Controller.DestroyPlayer(col.gameObject); FloatingTextController.CreateFloatingTextWhenEatEnemies("+" + score.ToString()); } } }