Cakewalk.Server.Zones.Zone.RemoveEntity C# (CSharp) Метод

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

Remove an entity from this zone
public RemoveEntity ( ServerEntity entity ) : void
entity ServerEntity
Результат void
        public void RemoveEntity(ServerEntity entity)
        {
            if (m_entities.ContainsKey(entity.WorldID))
            {
                m_entities.Remove(entity.WorldID);
            }
        }

Usage Example

Пример #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);
        }
All Usage Examples Of Cakewalk.Server.Zones.Zone::RemoveEntity