public void RemoveCharacter(Character character) { if (character is PlayerCharacter) { Players.Remove(character as PlayerCharacter); } else if (character is NonPlayerCharacter) { Mobs.Remove(character as NonPlayerCharacter); } }
public void RemoveMob(Mob mob) { Mobs.Remove(mob); }
public void RemoveMob(WvsGameClient c, CMob mob) { Mobs.Remove(mob.dwMobId); Broadcast(CPacket.MobLeaveField(mob)); }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (Mobs.Count == 0 && !RoomDone) { RoomDone = true; foreach (Door d in DoorRoom.Values) { d.Open(); } } foreach (MobEntity entity in Mobs) { foreach (MobEntity entity2 in Mobs) { entity2.CollisionHandler(entity.HitBox); } } foreach (MobEntity entity in new List <MobEntity>(Mobs)) { entity.Update(gameTime); if (Player.IsHitting()) { entity.HitHandler(Player.WeaponHitBox, Player.GetDamages()); } if (entity.HealthPoints <= 0) { Mobs.Remove(entity); } if (entity.IsHitting()) { Player.HitHandler(entity.AttaqueHitBox, entity.Damages); } if (Player.HealthPoints <= 0) { Mobs.Remove(entity); } } List <Entity> allEntities = new List <Entity>(Mobs); allEntities.Add(Player); foreach (Entity entity in allEntities) { int offsetX = ((map.Width - 3) * tileWidth) / 2 - entity.EntitySprite.SpriteWidth; int offsetY = ((map.Height - 3) * tileHeight) / 2 - entity.EntitySprite.SpriteHeight; if (entity.Position.X > offsetX) { entity.Position = new Vector2(offsetX, entity.Position.Y); } else if (entity.Position.X < -offsetX) { entity.Position = new Vector2(-offsetX, entity.Position.Y); } if (entity.Position.Y > offsetY) { entity.Position = new Vector2(entity.Position.X, offsetY); } else if (entity.Position.Y < -offsetY) { entity.Position = new Vector2(entity.Position.X, -offsetY); } } foreach (KeyValuePair <Room, Door> kv in DoorRoom) { if (Player.CollideDoor(kv.Value.HitBox) && RoomDone) { Player.Position = Vector2.Zero; AV.SetCurrentRoom(kv.Key); } } }
public void RemoveMob(MobState mob) { Mobs.Remove(mob); IdsUsed.Remove(mob.Id); }