public void OnCollision(GameObject other) { if (other is Enemy) { Enemy enemy = other as Enemy; enemy.Destroy(); MyGame myGame = game as MyGame; myGame.AddScore(); } else if (other is Crate) { Destroy(); } }