Exemplo n.º 1
0
 private void AddNewCreatures()
 {
     foreach (var newSimObject in NewSimObjects)
     {
         SimObjects.Add(newSimObject);
     }
     NewSimObjects.Clear();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Delete all the dead creatures from the context
        /// </summary>
        private void RemoveDeadCreatures()
        {
            var dc = GetDeadCreatures();

            if (!dc.Any())
            {
                return;
            }
            foreach (var deadCreature in GetDeadCreatures())
            {
                SimObjects.Remove(deadCreature);
            }
        }
        public void DeletePrim(Primitive thePrim)
        {
            if (thePrim is Avatar)
            {
                return;
            }
            SimObject O = GetSimObject(thePrim);

            if (O != null)
            {
                SimObjects.Remove(O);
                SimRootObjects.Remove(O);
                SimChildObjects.Remove(O);
                SimAttachmentObjects.Remove(O);
                SimAvatars.Remove(O);
                SendOnRemoveSimObject(O);
            }
            uint objectLocalID = thePrim.LocalID;

            client.Inventory.RequestDeRezToInventory(objectLocalID, DeRezDestination.AgentInventoryTake,
                                                     client.Inventory.FindFolderForType(AssetType.TrashFolder),
                                                     UUID.Random());
        }
Exemplo n.º 4
0
 public void RemoveSimObject(SimObject simObject) => SimObjects.Remove(simObject);
Exemplo n.º 5
0
 public void AddObstacle(int xPos, int yPos)
 {
     SimObjects.Add(new Obstacle(xPos, yPos, this));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Add a new obstacle to the SimObjects list
 /// </summary>
 /// <param name="obstacle">Obstacle object</param>
 public void AddObstacle(Obstacle obstacle) => SimObjects.Add(obstacle);
Exemplo n.º 7
0
 public void AddPlant(int energy, int xPos, int yPos)
 {
     SimObjects.Add(new Plant(energy, xPos, yPos, this));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Add a new plant to the SimObjects list
 /// </summary>
 /// <param name="plant">Plant object</param>
 public void AddPlant(Plant plant) => SimObjects.Add(plant);
Exemplo n.º 9
0
 /// <summary>
 /// Add a new creature to the SimObjects list
 /// </summary>
 /// <param name="creature">Creature object</param>
 public void AddCreature(Creature creature) => SimObjects.Add(creature);
Exemplo n.º 10
0
 /// <summary>
 /// Check if the location contains any SimObjects
 /// </summary>
 /// <param name="xPos">The x position to look on the grid</param>
 /// <param name="yPos">The Y position to look on the grid</param>
 /// <returns>True if the location contains a SimObject, else False</returns>
 public bool HasSimObjects(int xPos, int yPos)
 {
     return(SimObjects.Any(s => s.XPos == xPos && s.YPos == yPos));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Get all the dead creatures in the context.
 ///
 /// A creature is dead when the energy is equal to or lower then 0.
 /// </summary>
 /// <returns>List of all the dead creatures in the context</returns>
 public ReadOnlyCollection <Creature> GetDeadCreatures()
 => SimObjects.OfType <Creature>().Where(c => c.IsAlive == false).ToList().AsReadOnly();
Exemplo n.º 12
0
        /// <summary>
        /// get all simobjects of a certain SimObject type
        /// </summary>
        /// <typeparam name="TSimObject">A type of SimObject</typeparam>
        /// <returns></returns>
        public ReadOnlyCollection <TSimObject> GetSimObjects <TSimObject>() where TSimObject : SimObject
        {
            var so = SimObjects.OfType <TSimObject>().ToList();

            return(new ReadOnlyCollection <TSimObject>(so));
        }