Files
RuinAdventurer/Scripts/Helpers/UIHandler.cs
T

37 lines
874 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;
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);
};
}
public void ChangeColor(Color color)
{
GameData.lightColor = color;
LightHandler.RedrawLights(color);
}
public void ShowCodingWindow(Robot robot)
{
codingWindow.ShowWindow(robot);
}
}