wServer.realm.World.LeaveWorld C# (CSharp) Method

LeaveWorld() public method

public LeaveWorld ( Entity entity ) : void
entity Entity
return void
        public virtual void LeaveWorld(Entity entity)
        {
            if (entity is Player)
            {
                Player dummy;
                Players.TryRemove(entity.Id, out dummy);
                PlayersCollision.Remove(entity);
            }
            else if (entity is Enemy)
            {
                Enemy dummy;
                Enemies.TryRemove(entity.Id, out dummy);
                EnemiesCollision.Remove(entity);
                if (entity.ObjectDesc.Quest)
                    Quests.TryRemove(entity.Id, out dummy);
                if (entity.isPet)
                {
                    Entity dummy2;
                    Pets.TryRemove(entity.Id, out dummy2);
                }
            }
            else if (entity is Projectile)
            {
                var p = entity as Projectile;
                Projectiles.TryRemove(new Tuple<int, byte>(p.ProjectileOwner.Self.Id, p.ProjectileId), out p);
            }
            else if (entity is StaticObject)
            {
                StaticObject dummy;
                StaticObjects.TryRemove(entity.Id, out dummy);
                if (entity is Decoy)
                    PlayersCollision.Remove(entity);
                else
                    EnemiesCollision.Remove(entity);
            }
            entity.Owner = null;
        }

Usage Example

Ejemplo n.º 1
0
        public bool RemovePortal(int worldId)
        {
            if (_world == null)
            {
                return(false);
            }

            using (TimedLock.Lock(_worldLock))
            {
                if (!_portals.ContainsKey(worldId))
                {
                    return(false);
                }

                var portal = _portals[worldId];
                _world.LeaveWorld(portal);
                _portals.Remove(worldId);
                return(true);
            }
        }
All Usage Examples Of wServer.realm.World::LeaveWorld