New UI Controller for controlling/tweening UI elements, start of proper project layout

This commit is contained in:
Xevion
2020-05-20 13:04:30 -05:00
parent 154867c445
commit 3620113261
2 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
using UnityEngine;
using UnityEngine.UI;
public class UIController : MonoBehaviour {
public Button startButton;
public Button settingsButton;
public Text titleText;
public BoidController boidController;
// Element Groups
private GameObject[] _titleElements;
private GameObject[] _settingsElements;
private GameObject[] _aboutElements;
private GameObject[] _adjustmentElements;
private UIStance _currentUI;
private enum UIStance {
Title,
Play,
Settings,
About
}
private void Start() {
// Add event functions
startButton.onClick.AddListener(OnStartButton);
settingsButton.onClick.AddListener(OnSettingsButton);
// Organize all UI Game Objects
_titleElements = new GameObject[]
{titleText.gameObject, startButton.gameObject, settingsButton.gameObject};
_settingsElements = new GameObject[]
{ };
_aboutElements = new GameObject[] { };
_adjustmentElements = new GameObject[] { };
}
// Handle Start Button Clicking
private void OnStartButton() {
// Move the Title Text up
startButton.interactable = settingsButton.interactable = false;
foreach (GameObject element in _titleElements) {
LeanTween
.move(element, element.transform.position + new Vector3(0, 500, 0), 1.2f)
.setEase(LeanTweenType.easeInCubic);
}
}
private void SwitchScreen(UIStance next) {
}
// Handle Settings Button Clicking
private void OnSettingsButton() {
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 647fe7597837a57488da7adef2a4fc71
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: