Example #1
0
 private CitySlot(int id, Vector3 pos)
 {
     slotID      = id;
     position    = pos;
     occupant    = null;
     hasOccupant = false;
 }
Example #2
0
 public bool SetOccupant(BO_Static newOcc)
 {
     if (IsAvailable)
     {
         if (freeSlotList.Remove(this))
         {
             availableSlots--;
         }
         else
         {
             Debug.LogError("available slot desync?");
         }
         hasOccupant = true;
         occupant    = newOcc;
         if (!TypeAdd(this))
         {
             Debug.LogError("type lookup dict desync?");
         }
         occupant.AssignCitySlot(this);
         return(true);
     }
     return(false);
 }
Example #3
0
        public bool EmptyOccupant()
        {
            if (!IsAvailable)
            {
                if (!freeSlotList.Contains(this))
                {
                    freeSlotList.Add(this);
                    availableSlots++;
                }
                else
                {
                    Debug.LogError("available slot desync?");
                }

                if (!TypeRemove(this))
                {
                    Debug.LogError("type lookup dict desync?");
                }
                hasOccupant = false;
                occupant    = null;
                return(true);
            }
            return(false);
        }