Exemplo n.º 1
0
        private void SetInvisible(IEntity entity, VisibilitySetInvisibleEventArgs args)
        {
            entity.GetComponent <VisibilityComponent>().IsVisible = false;
            if (!args.Broadcast)
            {
                return;
            }

            foreach (IEntity entityy in entity.EntityManager.Entities.Where(Match))
            {
                if (entityy is IPlayerEntity player)
                {
                    player.SendPacket(new OutPacketBase(player));
                }
            }
        }
Exemplo n.º 2
0
        private void SetInvisible(IEntity entity, VisibilitySetInvisibleEventArgs args)
        {
            Log.Info($"[ENTITY:{entity.Id}] INVISIBLE");
            entity.GetComponent <VisibilityComponent>().IsVisible = false;
            if (!args.Broadcast)
            {
                return;
            }

            foreach (IEntity entityy in entity.EntityManager.Entities)
            {
                if (entityy.Id == entity.Id || !Match(entityy))
                {
                    continue;
                }

                if (entityy is IPlayerEntity player)
                {
                    player.SendPacket(new OutPacketBase(player));
                }
            }
        }
Exemplo n.º 3
0
        private void SetInvisible(IEntity entity, VisibilitySetInvisibleEventArgs args)
        {
            entity.GetComponent <VisibilityComponent>().IsVisible = false;
            if (!args.Broadcast)
            {
                return;
            }

            foreach (IEntity entityy in entity.EntityManager.Entities.Where(Match))
            {
                var           player = entityy as IPlayerEntity;
                OutPacketType outPacketType;
                switch (entity.Type)
                {
                case EntityType.Player:
                    outPacketType = OutPacketType.Character;
                    break;

                case EntityType.Mate:
                case EntityType.Npc:
                    outPacketType = OutPacketType.MateOrNpc;
                    break;

                case EntityType.Monster:
                    outPacketType = OutPacketType.Monster;
                    break;

                default:
                    // unhandled
                    continue;
                }

                player?.SendPacket(new OutPacketBase {
                    EntityId = entity.Id, Type = outPacketType
                });
            }
        }