From f4da05897304db39cf6c82db27f7583d22fbfffa Mon Sep 17 00:00:00 2001 From: cryy22 <116713472+cryy22@users.noreply.github.com> Date: Fri, 26 Apr 2024 22:37:25 -0700 Subject: [PATCH] clean house from a tutorial perspective!! --- Runtime/Patterns/Managers.meta | 3 - Runtime/Patterns/Managers/Manager.cs | 68 ------------------- Runtime/Patterns/Managers/Manager.cs.meta | 3 - Runtime/Patterns/Managers/ManagerConfig.cs | 7 -- .../Patterns/Managers/ManagerConfig.cs.meta | 3 - Runtime/Patterns/Managers/ManagerEventArgs.cs | 10 --- .../Managers/ManagerEventArgs.cs.meta | 3 - Runtime/Patterns/Managers/ManagerState.cs | 7 -- .../Patterns/Managers/ManagerState.cs.meta | 3 - 9 files changed, 107 deletions(-) delete mode 100644 Runtime/Patterns/Managers.meta delete mode 100644 Runtime/Patterns/Managers/Manager.cs delete mode 100644 Runtime/Patterns/Managers/Manager.cs.meta delete mode 100644 Runtime/Patterns/Managers/ManagerConfig.cs delete mode 100644 Runtime/Patterns/Managers/ManagerConfig.cs.meta delete mode 100644 Runtime/Patterns/Managers/ManagerEventArgs.cs delete mode 100644 Runtime/Patterns/Managers/ManagerEventArgs.cs.meta delete mode 100644 Runtime/Patterns/Managers/ManagerState.cs delete mode 100644 Runtime/Patterns/Managers/ManagerState.cs.meta diff --git a/Runtime/Patterns/Managers.meta b/Runtime/Patterns/Managers.meta deleted file mode 100644 index bb2d5f1..0000000 --- a/Runtime/Patterns/Managers.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 382b5e2d80b24522b2f1ad33723c8bf2 -timeCreated: 1691183549 \ No newline at end of file diff --git a/Runtime/Patterns/Managers/Manager.cs b/Runtime/Patterns/Managers/Manager.cs deleted file mode 100644 index f1f5ea7..0000000 --- a/Runtime/Patterns/Managers/Manager.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections; -using UnityEngine; - -namespace Crysc.Patterns.Managers -{ - public class Manager : MonoBehaviour - where TConfig : ManagerConfig - where TState : ScriptableObject - { - public event EventHandler Changed; - [SerializeField] private GameObject Container; - - public bool IsActive - { - get => _isActive; - private set - { - _isActive = value; - Changed?.Invoke(sender: this, e: new ManagerEventArgs(value)); - } - } - - protected TConfig Config { get; private set; } - protected TState State { get; private set; } - private bool _isActive; - - protected virtual void Awake() - { - if (Container != null) Container.SetActive(false); - } - - public IEnumerator BeginAndWaitForEnd(TConfig config, TState state) - { - Begin(config: config, state: state); - yield return new WaitUntil(() => !IsActive); - } - - public virtual void Begin(TConfig config, TState state) - { - if (gameObject.activeInHierarchy == false) - throw new ApplicationException("#Begin called on Coordinator that is not active in hierarchy."); - if (IsActive) - Debug.LogWarning("#Begin called on Coordinator that is already active."); - - Config = config; - State = state; - - - IsActive = true; - if (Container != null) Container.SetActive(true); - } - - public virtual void End() - { - if (!IsActive) Debug.LogWarning("#End called on Coordinator that is not active."); - - Config = null; - State = null; - - if (Container != null) Container.SetActive(false); - IsActive = false; - } - } - - public class Manager : Manager - { } -} diff --git a/Runtime/Patterns/Managers/Manager.cs.meta b/Runtime/Patterns/Managers/Manager.cs.meta deleted file mode 100644 index ed1ea09..0000000 --- a/Runtime/Patterns/Managers/Manager.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 8b955b6f56184c49860773781f7896bb -timeCreated: 1671192778 \ No newline at end of file diff --git a/Runtime/Patterns/Managers/ManagerConfig.cs b/Runtime/Patterns/Managers/ManagerConfig.cs deleted file mode 100644 index ff278da..0000000 --- a/Runtime/Patterns/Managers/ManagerConfig.cs +++ /dev/null @@ -1,7 +0,0 @@ -using UnityEngine; - -namespace Crysc.Patterns.Managers -{ - public class ManagerConfig : ScriptableObject - { } -} diff --git a/Runtime/Patterns/Managers/ManagerConfig.cs.meta b/Runtime/Patterns/Managers/ManagerConfig.cs.meta deleted file mode 100644 index f1d3e95..0000000 --- a/Runtime/Patterns/Managers/ManagerConfig.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 2cb8a079b6164a9581d2eab8132136fa -timeCreated: 1675214280 \ No newline at end of file diff --git a/Runtime/Patterns/Managers/ManagerEventArgs.cs b/Runtime/Patterns/Managers/ManagerEventArgs.cs deleted file mode 100644 index c3a4b48..0000000 --- a/Runtime/Patterns/Managers/ManagerEventArgs.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Crysc.Patterns.Managers -{ - public class ManagerEventArgs : EventArgs - { - public bool IsActive { get; } - public ManagerEventArgs(bool isActive) { IsActive = isActive; } - } -} diff --git a/Runtime/Patterns/Managers/ManagerEventArgs.cs.meta b/Runtime/Patterns/Managers/ManagerEventArgs.cs.meta deleted file mode 100644 index d152010..0000000 --- a/Runtime/Patterns/Managers/ManagerEventArgs.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 90cb44e062e94d50a1c30c8f581d910d -timeCreated: 1671193175 \ No newline at end of file diff --git a/Runtime/Patterns/Managers/ManagerState.cs b/Runtime/Patterns/Managers/ManagerState.cs deleted file mode 100644 index 1368883..0000000 --- a/Runtime/Patterns/Managers/ManagerState.cs +++ /dev/null @@ -1,7 +0,0 @@ -using UnityEngine; - -namespace Crysc.Patterns.Managers -{ - public abstract class ManagerState : ScriptableObject - { } -} diff --git a/Runtime/Patterns/Managers/ManagerState.cs.meta b/Runtime/Patterns/Managers/ManagerState.cs.meta deleted file mode 100644 index 03c2ec3..0000000 --- a/Runtime/Patterns/Managers/ManagerState.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 91bda681dd1b46ea865fbe1c1eaede40 -timeCreated: 1675214309 \ No newline at end of file