RemoveEntity() публичный Метод

Remove an entity from this zone
public RemoveEntity ( ServerEntity entity ) : void
entity ServerEntity
Результат void
Пример #1
0
        /// <summary>
        /// Tries to move a user in to a new zone.
        /// </summary>
        public bool RequestZoneTransfer(ServerEntity entity, int newZoneID)
        {
            //Check the zone exists
            if (m_zones.ContainsKey(newZoneID))
            {
                Zone newZone = m_zones[newZoneID];

                //See if the user is already in a zone
                if (m_userZones.ContainsKey(entity))
                {
                    //Remove them from their current zone
                    Zone currentZone = m_userZones[entity];
                    currentZone.RemoveEntity(entity);
                }
                else
                {
                    //Add them to the zone index
                    m_userZones.Add(entity, newZone);
                }

                //Move them in to their new zone
                m_userZones[entity] = newZone;
                newZone.AddEntity(entity);

                return(true);
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// Remove an entity from the zone that they are in
        /// </summary>
        public void RemoveEntity(ServerEntity entity)
        {
            Zone zone = null;

            m_userZones.TryGetValue(entity, out zone);
            if (zone != null)
            {
                zone.RemoveEntity(entity);
            }
        }