void OnTriggerEnter2D(Collider2D coll) { // Food? if (coll.tag == "Food") { // Get longer in next Move call ate = true; // Remove the Food Destroy(coll.gameObject); gameManager.UpdateScore(); } // Collided with Tail or Border else if (coll.tag == "Border" || coll.tag == "Tail") { gameManager.EndGame(); } }
/// <summary> /// Enemy has been killed. Add points and remove enemy from game. /// </summary> public void GrantEnemyResourcesToPlayer() { _gameManager.UpdateScore(_score); _gameManager.UpdateCoins(_coins, Operator.Add); }