public void OnCollision(Direction direction, SpriteCollection other, Rectangle intersection) { if (other is SpriteMario) { SpriteMario mario = other as SpriteMario; if (SpriteLayer.CollisionLayer.Sprites.Contains(this)) { mario.coins++; mario.points += 200; this.game.pointGenerator.Add(200, this); if (mario.coins / mario.nextLife == 100) { mario.lives++; mario.nextLife++; } SoundFactory.PlaySoundEffect(SoundFactory.Coin()); } SpriteLayer.CollisionLayer.RemoveSprite(this); } }