SHADE_Y3/Assets/Scripts/UI/SC_InverseCamera.cs

54 lines
1.1 KiB
C#

using SHADE;
using SHADE_Scripting.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class InverseCamera : Script
{
public bool inverseX = false;
public bool inverseY = false;
protected override void awake()
{
UIElement ui = GetComponent<UIElement>();
if (ui)
{
Toggle toggle = ui.GetComponent<Toggle>();
if(inverseX)
toggle.SetValue(Settings.inverseX);
if(inverseY)
toggle.SetValue(Settings.inverseY);
}
else
{
Debug.LogError("Failed to register Toggle action for inverse");
}
}
protected override void start()
{
UIElement ui = GetComponent<UIElement>();
if (ui)
{
ui.OnClick.RegisterAction(() =>
{
Toggle toggle = ui.GetComponent<Toggle>();
if(inverseX)
Settings.inverseX = toggle.GetValue();
if(inverseY)
Settings.inverseY = toggle.GetValue();
});
}
else
{
Debug.LogError("Failed to register Toggle action for inverse");
}
}
}