Added robot display to map logic, now need to add the color for it.
This commit is contained in:
@@ -21,6 +21,7 @@ public partial class Robot : Node3D
|
||||
public bool isCoolingDown = false;
|
||||
public bool isBroken = false;
|
||||
public string robotType = "iron_robot";
|
||||
public bool showOnMap = true;
|
||||
|
||||
private RobotTypeStats TypeStats =>
|
||||
GameData.robotStats.RobotTypes.TryGetValue(robotType, out RobotTypeStats stats)
|
||||
|
||||
@@ -43,6 +43,12 @@ public partial class CodingWindow : PanelContainer
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMapToggled(bool toggledOn)
|
||||
{
|
||||
if(robot == null) return;
|
||||
robot.showOnMap = toggledOn;
|
||||
}
|
||||
|
||||
public void OnNodeSelect(NodeDisplay node)
|
||||
{
|
||||
selectedNode = node;
|
||||
|
||||
@@ -22,6 +22,21 @@ public partial class Map : PanelContainer
|
||||
Tile[,] tiles = GameData.map[GameData.currentLayer].tiles;
|
||||
int size = GameData.layerSize;
|
||||
|
||||
Dictionary<Vector2I, List<Robot>> visibleRobots = new Dictionary<Vector2I, List<Robot>>();
|
||||
|
||||
Vector3I tilePos;
|
||||
Vector2I key;
|
||||
|
||||
foreach(Robot robot in GameData.robots)
|
||||
{
|
||||
if(!robot.showOnMap) continue;
|
||||
tilePos = Pathfinding.GetClosestStartPoint(robot.Position);
|
||||
if(tilePos.Y != GameData.visibleLayer) continue;
|
||||
key = new Vector2I(tilePos.X, tilePos.Z);
|
||||
if(!visibleRobots.ContainsKey(key)) visibleRobots.Add(key, new List<Robot>());
|
||||
visibleRobots[key].Add(robot);
|
||||
}
|
||||
|
||||
for (int z = -1; z < size; z++)
|
||||
{
|
||||
for (int x = -1; x < size; x++)
|
||||
|
||||
Reference in New Issue
Block a user