private void TouchPlayer(float deltaTime) { List <Entity> touched; touched = MyScene.GetEntities(x, y); bool hit = false; foreach (Entity e in touched) { if (e is Player) { hit = true; break; } } if (hit) { MyScene.RemoveEntity(this); } }
private void TouchPlayer() { //Get the List of Entities in our space List <Entity> touched = MyScene.GetEntities(X, Y); //Check if any of them are Players bool hit = false; foreach (Entity e in touched) { if (e is Player) { hit = true; break; } } //If we hit a Player, remove this Enemy from the Scene if (hit) { MyScene.RemoveEntity(this); } }