From 49b1bcd578aa5d3b6f84750e730d179a950f26c8 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Mon, 21 Nov 2022 13:48:58 +0300 Subject: [PATCH] Assembly Definition & Improvements --- FactorySingleton.cs | 7 ++----- IFactory.cs | 7 +++++++ Syntriax.Modules.Factory.asmdef | 3 +++ Syntriax.Modules.Factory.asmdef.meta | 7 +++++++ 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 Syntriax.Modules.Factory.asmdef create mode 100644 Syntriax.Modules.Factory.asmdef.meta diff --git a/FactorySingleton.cs b/FactorySingleton.cs index 60c3b12..30ec234 100644 --- a/FactorySingleton.cs +++ b/FactorySingleton.cs @@ -2,7 +2,7 @@ using UnityEngine; namespace Syntriax.Modules.Factory { - public abstract class FactorySingleton : MonoBehaviour, IFactory where T : Component, IFactory + public abstract class FactorySingleton : MonoBehaviour where T : FactoryBase { public const string ParentName = "Factories"; private static T _instance = null; @@ -13,7 +13,7 @@ namespace Syntriax.Modules.Factory if (_instance == null) { GameObject factoriesGO = GameObject.Find(ParentName) ?? new GameObject(ParentName); - _instance = new GameObject(nameof(T)).AddComponent(); + _instance = new GameObject(typeof(T).Name).AddComponent(); _instance.transform.SetParent(factoriesGO.transform); DontDestroyOnLoad(factoriesGO); } @@ -21,8 +21,5 @@ namespace Syntriax.Modules.Factory return _instance; } } - - public void Initialize() => Instance.Initialize(); - public void Reset() => Instance.Reset(); } } diff --git a/IFactory.cs b/IFactory.cs index 6a2360c..ce47ebe 100644 --- a/IFactory.cs +++ b/IFactory.cs @@ -2,7 +2,14 @@ namespace Syntriax.Modules.Factory { public interface IFactory { + /// + /// Initializes the + /// public void Initialize(); + + /// + /// Resets the + /// public void Reset(); } } diff --git a/Syntriax.Modules.Factory.asmdef b/Syntriax.Modules.Factory.asmdef new file mode 100644 index 0000000..b6f95bb --- /dev/null +++ b/Syntriax.Modules.Factory.asmdef @@ -0,0 +1,3 @@ +{ + "name": "Syntriax.Modules.Factory" +} diff --git a/Syntriax.Modules.Factory.asmdef.meta b/Syntriax.Modules.Factory.asmdef.meta new file mode 100644 index 0000000..d15edb6 --- /dev/null +++ b/Syntriax.Modules.Factory.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d4c952ed5f59c5a449cda1b0080ed841 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: