static public void CheckCollisionWith(Moving_entity ent) { if (ent.GetType() == typeof(Frog)) { Frog frog = (Frog)ent; for (int i = 0; i < bullets.Count; i++) { if (bullets[i].isAlive) { if (DistanceBetween(frog.position, bullets[i].position) < bullets[i].GetHitRadius) { AddExplosion(frog.position); frog.commandList.AddMessage(Command.Hit, 10); bullets[i].Kill(); } } } } else if (ent.GetType() == typeof(Player)) { Player player = (Player)ent; for (int i = 0; i < bullets.Count; i++) { if (bullets[i].isAlive) { if (DistanceBetween(player.position, bullets[i].position) < bullets[i].GetHitRadius) { AddExplosion(player.position); player.commandList.AddMessage(Command.Hit, 10); bullets[i].Kill(); } } } } }
static public bool CheckEntityCollision(Moving_entity ent) { for (int i = 0; i < enemies.Count; i++) { if (ent.id != enemies[i].id && ent.DistanceBetween(enemies[i].position) < ent.size) { return(true); } } return(false); }
static private void CheckBulletHit(Moving_entity enemy) { BulletController.CheckCollisionWith(enemy); }