47 lines
1022 B
C#
47 lines
1022 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Godot;
|
|
|
|
public partial class UIHandler : Control
|
|
{
|
|
[Export] CodingWindow codingWindow;
|
|
[Export] RobotList robotList;
|
|
[Export] Information information;
|
|
[Export] Camera3D mainCam;
|
|
[Export] Map map;
|
|
public override void _Ready()
|
|
{
|
|
GetNode<ColorPickerButton>("./MainUI/HeaderContainer/Header/LightColor").Color = GameData.lightColor;
|
|
}
|
|
|
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
public override void _Process(double delta)
|
|
{
|
|
robotList.OnRobotJumpTo += (robot) =>
|
|
{
|
|
mainCam.Position = new Vector3(robot.Position.X, mainCam.Position.Y, robot.Position.Z + 3f);
|
|
ShowCodingWindow(robot);
|
|
};
|
|
|
|
if (Input.IsActionJustPressed("map"))
|
|
{
|
|
map.Visible = !map.Visible;
|
|
if (map.Visible)
|
|
{
|
|
map.ShowMap();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ChangeColor(Color color)
|
|
{
|
|
GameData.lightColor = color;
|
|
LightHandler.RedrawLights(color);
|
|
}
|
|
|
|
public void ShowCodingWindow(Robot robot)
|
|
{
|
|
codingWindow.ShowWindow(robot);
|
|
}
|
|
}
|