Пример #1
0
 /// <summary>
 /// updates the info of the object, and it's surrounding tiles,
 /// and checks to make sure the position that the object is attempting to be placed at is valid
 /// </summary>
 /// <param name="obj">Object that is trying to be deleted</param>
 /// <param name="deleteNeighbors">deleteNeighbors, defaults to true and determines whether the Object's neighbors should be deleted</param>
 public static void DeleteObject(Chair obj, bool deleteNeighbors = true)
 {
     obj.isDeleted = true;
     foreach (Tile t in obj.tiles)
     {
         if (t.objs.Contains(obj) == true)
         {
             t.objs.Remove(obj);
         }
         if (obj.tiles.Contains(t) == true)
         {
             obj.tiles.Remove(t);
         }
     }
     obj.diffPos = new Vector3(0, 0, 0);
     if (obj.cbObjectChanged != null)
     {
         obj.cbObjectChanged(obj);
     }
     if (obj.connectsToNeighbors == true && Object.moveNeighbors == true && deleteNeighbors == true)
     {
         obj.DeleteNeighbors(obj);
     }
     obj.UpdateNeighbors(obj);
 }