void OnTriggerEnter2D(Collider2D coll) { // Food? if (coll.gameObject.tag.Equals("Apple")) { // Get longer in next Move call ate = true; // Remove the Food Destroy(coll.gameObject); gc.AddScore(score_apple * mult_score); } // Collided with meat else if (coll.gameObject.tag.Equals("Meat")) { // Remove the Meat Destroy(coll.gameObject); gc.AddScore(score_meat * mult_score); } // Collided with medicine else if (coll.gameObject.tag.Equals("Medicine")) { // Remove the Medicine Destroy(coll.gameObject); foreach (GameObject go in GameObject.FindGameObjectsWithTag("Virus")) { Destroy(go); } } // Collided with Tail or Virus else if (coll.gameObject.tag.Equals("Virus") || coll.gameObject.tag.Equals("Tail")) { // Destroy Snake? // Destroy(this.gameObject); if (!gc.PlayerDie()) { transform.position = originalPos; } // ToDo 'You lose' screen } // Collided with rune else if (coll.gameObject.tag.Equals("Rune")) { // Remove the rune Destroy(coll.gameObject); rune_duration_temp = rune_duration; int temp; if (Random.Range(1, 100) % 2 == 0) { temp = double_rune_mult; } else { temp = triple_rune_mult; } string runeEffect; if (Random.Range(1, 100) % 2 == 0) { act_rune[0] = 1; act_rune[1] = temp + 1; runeEffect = "Speed X" + temp; mult_speed *= temp + 1; } else { act_rune[0] = 2; act_rune[1] = temp; runeEffect = "Score X" + temp; mult_score *= temp; } gc.ShowRuneEffect(runeEffect); gc.AddScore(score_rune * mult_score); } // Collided with WormHole else if (coll.gameObject.tag.Equals("WormHole")) { float loc_y = transform.position.y, loc_x = transform.position.x; foreach (GameObject go in GameObject.FindGameObjectsWithTag("WormHole")) { if (go != coll.gameObject) { loc_x = go.gameObject.transform.position.x; loc_y = go.gameObject.transform.position.y; } } transform.position = new Vector3((loc_x + 2 * dir[0]), (loc_y + 2 * dir[1]), -1f); } // Collided with Potion else if (coll.gameObject.tag.Equals("Potion")) { // Remove the Potion Destroy(coll.gameObject); gc.AddLife(); } }