コード例 #1
0
        public static void MarkForRefill(this SlotGroup group, Map map, bool enable)
        {
            RefillZoneComp comp = map.GetComponent <RefillZoneComp>();

            if (group.parent is Building_Storage building)
            {
                if (enable)
                {
                    comp.markedForRefillBuilding.Add(building);
                }
                else
                {
                    comp.markedForRefillBuilding.Remove(building);
                }
            }
            else if (group.parent is Zone_Stockpile zone)
            {
                if (enable)
                {
                    comp.markedForRefillStockpile.Add(zone);
                }
                else
                {
                    comp.markedForRefillStockpile.Remove(zone);
                }
            }
        }
コード例 #2
0
        public static bool IsMarkedForRefill(this SlotGroup group, Map map)
        {
            RefillZoneComp comp = map.GetComponent <RefillZoneComp>();

            return(comp.markedForRefillBuilding.Contains(group.parent as Building_Storage) ||
                   comp.markedForRefillStockpile.Contains(group.parent as Zone_Stockpile));
        }