private void SetVisible(IEntity entity, VisibilitySetVisibleEventArgs args) { Log.Info($"[ENTITY:{entity.Id}] VISIBLE"); entity.GetComponent <VisibilityComponent>().IsVisible = true; if (!args.Broadcast) { return; } var inEntity = new InPacketBase(entity); foreach (IEntity entityy in entity.EntityManager.Entities) { if (entityy.Id == entity.Id || !Match(entityy)) { continue; } if (!(entity is IPlayerEntity session)) { if (entityy is IPlayerEntity player) { player.SendPacket(inEntity); } continue; } if (!args.IsChangingMapLayer) { continue; } if (!entityy.GetComponent <VisibilityComponent>().IsVisible) { continue; } switch (entityy.Type) { case EntityType.Monster: case EntityType.Mate: case EntityType.Npc: case EntityType.Player: var inpacket = new InPacketBase(entityy); session.SendPacket(inpacket); if (entityy is IPlayerEntity player) { player.SendPacket(inEntity); } break; case EntityType.Portal: session.SendPacket(new GpPacket(entityy)); break; } } }
private void SetVisible(IEntity entity, VisibilitySetVisibleEventArgs args) { entity.GetComponent <VisibilityComponent>().IsVisible = true; if (!args.Broadcast) { return; } foreach (IEntity i in entity.EntityManager.Entities.Where(Match)) { var player = i as IPlayerEntity; player?.SendPacket(new InfoPacketBase()); } }
private void SetVisible(IEntity entity, VisibilitySetVisibleEventArgs args) { entity.GetComponent <VisibilityComponent>().IsVisible = true; if (!args.Broadcast) { return; } foreach (IEntity entityy in entity.EntityManager.Entities.Where(Match)) { if (entityy is IPlayerEntity player) { player.SendPacket(new InPacketBase(player)); } } }