FSO.SimAntics.VM.RemoveEntity C# (CSharp) Method

RemoveEntity() public method

Removes an entity from this Virtual Machine.
public RemoveEntity ( FSO.SimAntics.VMEntity entity ) : void
entity FSO.SimAntics.VMEntity The entity to remove.
return void
        public void RemoveEntity(VMEntity entity)
        {
            if (Entities.Contains(entity))
            {
                Context.SetToNextCache.RemoveObject(entity);
                this.Entities.Remove(entity);
                ObjectsById.Remove(entity.ObjectID);
                if (entity.ObjectID < ObjectId) ObjectId = entity.ObjectID; //this id is now the smallest free object id.
            }
            entity.Dead = true;
        }

Usage Example

Ejemplo n.º 1
0
 public void RemoveObjectInstance(VMEntity target)
 {
     target.PrePositionChange(this);
     if (!target.GhostImage)
     {
         VM.RemoveEntity(target);
     }
     if (UseWorld)
     {
         if (target is VMGameObject)
         {
             Blueprint.RemoveObject((ObjectComponent)target.WorldUI);
         }
         else
         {
             Blueprint.RemoveAvatar((AvatarComponent)target.WorldUI);
         }
     }
 }