Example #1
0
 public static bool Prefix(BuildingCellVisualizer __instance, HashedString mode)
 {
     if (buildings.Contains(__instance.GetBuilding().Def.PrefabID))
     {
         UnityEngine.GameObject go         = __instance.GetBuilding().gameObject;
         PortDisplayController  controller = go.GetComponent <PortDisplayController>();
         if (controller != null)
         {
             return(controller.Draw(__instance, mode, go));
         }
     }
     return(true);
 }
        internal void Draw(GameObject obj, BuildingCellVisualizer visualizer, bool force)
        {
            Building building    = visualizer.GetBuilding();
            int      utilityCell = building.GetCellWithOffset(building.Orientation == Orientation.Neutral ? this.offset : this.offsetFlipped);

            // redraw if anything changed
            if (force || utilityCell != this.lastUtilityCell || color != this.lastColor)
            {
                this.lastColor       = color;
                this.lastUtilityCell = utilityCell;
                visualizer.DrawUtilityIcon(utilityCell, this.sprite, ref portObject, color, Color.white);
            }
        }