Added robot follow button
This commit is contained in:
@@ -6,7 +6,7 @@ public partial class UIHandler : Control
|
||||
{
|
||||
[Export] CodingWindow codingWindow;
|
||||
[Export] RobotList robotList;
|
||||
[Export] Camera3D mainCam;
|
||||
[Export] Camera3d mainCam;
|
||||
[Export] Map map;
|
||||
[Export] RichTextLabel FPS;
|
||||
[Export] RichTextLabel RAM;
|
||||
@@ -27,15 +27,18 @@ public partial class UIHandler : Control
|
||||
|
||||
|
||||
private bool receivedRobotJumpSignal = false;
|
||||
private bool receivedRobotFollowSignal = false;
|
||||
public override void _Ready()
|
||||
{
|
||||
UIStyle.Apply(this);
|
||||
robotList.OnRobotJumpTo += OnRobotJumpTo;
|
||||
robotList.OnRobotFollow += OnRobotFollow;
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
robotList.OnRobotJumpTo -= OnRobotJumpTo;
|
||||
robotList.OnRobotFollow -= OnRobotFollow;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
@@ -81,6 +84,7 @@ public partial class UIHandler : Control
|
||||
|
||||
public void HandleRobotListButton()
|
||||
{
|
||||
receivedRobotFollowSignal = false;
|
||||
receivedRobotJumpSignal = false;
|
||||
OpenUIElement(robotList);
|
||||
}
|
||||
@@ -182,6 +186,15 @@ public partial class UIHandler : Control
|
||||
OpenUIElement(codingWindow);
|
||||
}
|
||||
|
||||
private void OnRobotFollow(Robot robot)
|
||||
{
|
||||
if (receivedRobotFollowSignal) return;
|
||||
|
||||
receivedRobotFollowSignal = true;
|
||||
mainCam.Follow(robot);
|
||||
OpenUIElement(codingWindow);
|
||||
}
|
||||
|
||||
private void DisplaySurvivalStats()
|
||||
{
|
||||
energyLabel.Text = $"Energy: {GameData.survival.energy:0}/{GameData.survival.maxEnergy:0}";
|
||||
|
||||
Reference in New Issue
Block a user