diff --git a/Boids/Assets/Scripts/UIController.cs b/Boids/Assets/Scripts/UIController.cs index 8fabb70..6dc08e0 100644 --- a/Boids/Assets/Scripts/UIController.cs +++ b/Boids/Assets/Scripts/UIController.cs @@ -34,7 +34,7 @@ public class UIController : MonoBehaviour { private Rect _canvasRect; private float _scaleFactor; private int _activeTweens; - private bool _UILock => _activeTweens > 0; + private bool UILock => _activeTweens > 0; // Element Displacements private Vector3 _aboutDiff; @@ -43,13 +43,27 @@ public class UIController : MonoBehaviour { private Vector3 _settingsDiff; private Vector3 _adjustmentsDiff; + /// UIStance describes difference 'stances', or UI configurations. + /// allows easy change between different stances with the + /// method. Note, this enum is similar but different from the Enum. + /// + /// + /// private enum UIStance { Title, - Play, + PlayAdjust, + PlayHelp, + PlayHidden, Settings, About } + /// UIGroup describes distinct groups of UI elements. + /// This Enum is used within in order to describe specific portions of the application + /// compared to a 'UI Stance'. + /// This Enum may be removed and be functionally replaced with later on. + /// + /// private enum UIGroup { TitleScreen, AdjustmentsScreen, @@ -65,7 +79,7 @@ public class UIController : MonoBehaviour { _scaleFactor = Screen.width / _scaler.referenceResolution.x; // Add stance change functionality to buttons - startButton.onClick.AddListener(() => ChangeStance(UIStance.Play)); + startButton.onClick.AddListener(() => ChangeStance(UIStance.PlayAdjust)); aboutButton.onClick.AddListener(() => ChangeStance(UIStance.About)); aboutCloseButton.onClick.AddListener(() => ChangeStance(UIStance.Title)); settingsButton.onClick.AddListener(() => ChangeStance(UIStance.Settings)); @@ -102,7 +116,7 @@ public class UIController : MonoBehaviour { /// private void TweenEnd() { _activeTweens -= 1; - if (!_UILock) + if (!UILock) Debug.Log("Unlocking Stance Changes"); } @@ -114,7 +128,7 @@ public class UIController : MonoBehaviour { /// returns the action for a deconstructing callback /// private Action StartTween() { - if (!_UILock) + if (!UILock) Debug.Log("Locking Stance Changes"); _activeTweens += 1; return TweenEnd; @@ -128,11 +142,11 @@ public class UIController : MonoBehaviour { /// private void ChangeStance(UIStance stance) { // Quit early if UI is currently "locked" due to an active tween - if (_UILock || stance == _currentUI) + if (UILock || stance == _currentUI) return; Debug.Log($"UI Transition: {_currentUI} -> {stance}"); - + // Title -> Settings/About/Play if (_currentUI == UIStance.Title) { MoveElements(UIGroup.TitleScreen, true); @@ -140,13 +154,13 @@ public class UIController : MonoBehaviour { MoveElements(UIGroup.SettingsScreen, false); else if (stance == UIStance.About) MoveElements(UIGroup.AboutScreen, false); - else if (stance == UIStance.Play) + else if (stance == UIStance.PlayAdjust) MoveElements(UIGroup.AdjustmentsScreen, false); } // Settings/About/Play -> Title else if (stance == UIStance.Title) { MoveElements(UIGroup.TitleScreen, false); - if (_currentUI == UIStance.Play) + if (_currentUI == UIStance.PlayAdjust) MoveElements(UIGroup.AdjustmentsScreen, true); else if (_currentUI == UIStance.Settings) MoveElements(UIGroup.SettingsScreen, true);