Ejemplo n.º 1
0
 /// <summary>
 /// Applied after LoadGeneratedBuildings runs.
 /// </summary>
 internal static void Postfix()
 {
     foreach (var def in Assets.BuildingDefs)
     {
         if (def?.BuildingComplete != null)
         {
             AddConsumerPreview(def);
             // After it runs, the telescope and space scanner should have defs
             if (def.PrefabID == TelescopeConfig.ID)
             {
                 PUtil.LogDebug("Telescope visualizer added");
                 TelescopeVisualizer.Create(def.BuildingComplete);
                 TelescopeVisualizer.Create(def.BuildingPreview);
                 TelescopeVisualizer.Create(def.BuildingUnderConstruction);
             }
             if (def.PrefabID == CometDetectorConfig.ID)
             {
                 PUtil.LogDebug("Space scanner visualizer added");
                 SpaceScannerVisualizer.Create(def.BuildingComplete);
                 SpaceScannerVisualizer.Create(def.BuildingPreview);
                 SpaceScannerVisualizer.Create(def.BuildingUnderConstruction);
             }
         }
     }
 }
Ejemplo n.º 2
0
        protected override void VisualizeCells(ICollection <VisCellData> newCells)
        {
            int baseCell = Grid.PosToCell(gameObject), width = Grid.WidthInCells;

            if (Grid.IsValidCell(baseCell))
            {
                Grid.CellToXY(baseCell, out int startX, out int startY);
                // Base game adds 3 (height) and subtracts 3
                for (int x = -scanRadius; x <= scanRadius; x++)
                {
                    // Up to height limit
                    for (int y = startY; y < Grid.HeightInCells; y++)
                    {
                        int newX = startX + x - 1, cell = Grid.XYToCell(newX, y);
                        if (Grid.IsValidCell(cell) && newX >= 0 && newX <= width)
                        {
                            newCells.Add(new VisCellData(cell, SpaceScannerVisualizer.
                                                         IsSunBlocked(cell) ? BLOCKED_TINT : Color.white));
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected override void VisualizeCells(ICollection <VisCellData> newCells)
        {
            int baseCell = Grid.PosToCell(gameObject);

            if (Grid.IsValidCell(baseCell))
            {
                Grid.CellToXY(baseCell, out int startX, out int startY);
                // Currently telescopes cannot be rotated in game
                for (int x = -scanRadius; x <= scanRadius; x++)
                {
                    // Up to height limit
                    for (int y = startY + 4; y < Grid.HeightInCells; y++)
                    {
                        int cell = Grid.XYToCell(startX + x - 1, y);
                        if (Grid.IsValidCell(cell))
                        {
                            newCells.Add(new VisCellData(cell, SpaceScannerVisualizer.
                                                         IsSunBlocked(cell) ? BLOCKED_TINT : Color.white));
                        }
                    }
                }
            }
        }