Example #1
0
        /// <summary>
        /// Checks to see if the cell should be dug. Removes the cell from the list and places
        /// the dig errand if it is ound.
        /// </summary>
        /// <param name="cell">The cell to check.</param>
        public void CheckDigQueue(int cell)
        {
            if (digCells.TryGetValue(cell, out PrioritySetting priority))
            {
                Prioritizable component;
                var           xy = Grid.CellToXY(cell);
                // Assign priority to the dig
                if (Grid.IsSolidCell(cell))
                {
                    var obj = DigTool.PlaceDig(cell);
#if DEBUG
                    PUtil.LogDebug("Placed dig in cell ({0:D},{1:D})".F(xy.X, xy.Y));
#endif
                    if ((component = obj.GetComponentSafe <Prioritizable>()) != null)
                    {
                        component.SetMasterPriority(priority);
                    }
                }
                else
                {
                    PUtil.LogDebug("Could not place dig in cell ({0:D},{1:D})".F(xy.X, xy.Y));
                }
                digCells.Remove(cell);
            }
        }
Example #2
0
 /// <summary>
 /// Checks to see if the cell should be dug. Removes the cell from the list and places
 /// the dig errand if it is ound.
 /// </summary>
 /// <param name="cell">The cell to check.</param>
 public void CheckDigQueue(int cell)
 {
     if (digCells.TryGetValue(cell, out PrioritySetting priority))
     {
         Prioritizable component;
         // Assign priority to the dig
         var obj = DigTool.PlaceDig(cell);
         var xy  = Grid.CellToXY(cell);
         PUtil.LogDebug("Placed dig in cell ({0:D},{1:D})".F(xy.X, xy.Y));
         if (obj != null && (component = obj.GetComponent <Prioritizable>()) != null)
         {
             component.SetMasterPriority(priority);
         }
         digCells.Remove(cell);
     }
 }
Example #3
0
 public static void DestroyInstance()
 {
     Instance = null;
 }
Example #4
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     Instance = this;
 }