53 lines
1.0 KiB
C#
53 lines
1.0 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 update()
|
|
{
|
|
UIElement ui = GetComponent<UIElement>();
|
|
if (ui)
|
|
{
|
|
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");
|
|
}
|
|
}
|
|
|
|
}
|
|
|