diff --git a/2D/OneWay2DAirMovement.cs b/2D/OneWay2DAirMovement.cs index 165531d..c25070c 100644 --- a/2D/OneWay2DAirMovement.cs +++ b/2D/OneWay2DAirMovement.cs @@ -1,7 +1,7 @@ using Syntriax.Modules.Movement.ColliderTrigger; using UnityEngine; -namespace Syntriax.Modules.Movement +namespace Syntriax.Modules.Movement.TwoDimensionalImplementations { public class OneWay2DAirMovement : OneWay2DMovementBase { diff --git a/2D/OneWay2DGroundMovement.cs b/2D/OneWay2DGroundMovement.cs index 28ba3ef..f0d7154 100644 --- a/2D/OneWay2DGroundMovement.cs +++ b/2D/OneWay2DGroundMovement.cs @@ -1,7 +1,7 @@ using Syntriax.Modules.Movement.ColliderTrigger; using UnityEngine; -namespace Syntriax.Modules.Movement +namespace Syntriax.Modules.Movement.TwoDimensionalImplementations { public class OneWay2DGroundMovement : OneWay2DMovementBase { diff --git a/2D/OneWay2DMovementBase.cs b/2D/OneWay2DMovementBase.cs index 338ee77..2883eb7 100644 --- a/2D/OneWay2DMovementBase.cs +++ b/2D/OneWay2DMovementBase.cs @@ -1,4 +1,4 @@ -namespace Syntriax.Modules.Movement +namespace Syntriax.Modules.Movement.TwoDimensionalImplementations { public abstract class OneWay2DMovementBase : TwoDimensionalMovementBase { diff --git a/2D/TwoDimensionalMovementBase.cs b/2D/TwoDimensionalMovementBase.cs index 03f05b2..dfa3d20 100644 --- a/2D/TwoDimensionalMovementBase.cs +++ b/2D/TwoDimensionalMovementBase.cs @@ -2,7 +2,7 @@ using Syntriax.Modules.Movement.State; using UnityEngine; using UnityEngine.Events; -namespace Syntriax.Modules.Movement +namespace Syntriax.Modules.Movement.TwoDimensionalImplementations { [RequireComponent(typeof(Rigidbody2D))] public abstract class TwoDimensionalMovementBase : MonoBehaviour, IMovement diff --git a/Config/MovementDefinitionFactory.cs b/Config/MovementDefinitionFactory.cs index d045c10..5e8a224 100644 --- a/Config/MovementDefinitionFactory.cs +++ b/Config/MovementDefinitionFactory.cs @@ -50,10 +50,13 @@ namespace Syntriax.Modules.Movement.Config Reset(); foreach (TextAsset definitionTextAsset in UnityEngine.Resources.LoadAll(ResourceDirectoryToDefinitions)) - { - MovementDefinition movementDefinition = JsonUtility.FromJson(definitionTextAsset.text); - AddDefinitionToFactory(movementDefinition); - } + AddToFactoryWithJSON(definitionTextAsset.text); + } + + public void AddToFactoryWithJSON(string definitionJSONText) + { + MovementDefinition movementDefinition = JsonUtility.FromJson(definitionJSONText); + AddDefinitionToFactory(movementDefinition); } public void Reset() => _definitions?.Clear(); diff --git a/Config/VariableMovementFactory.cs b/Config/VariableMovementFactory.cs index 5e052fd..6914ddd 100644 --- a/Config/VariableMovementFactory.cs +++ b/Config/VariableMovementFactory.cs @@ -53,10 +53,13 @@ namespace Syntriax.Modules.Movement.Config Reset(); foreach (TextAsset definitionTextAsset in UnityEngine.Resources.LoadAll(ResourceDirectoryToCollections)) - { - VMCollection collection = JsonUtility.FromJson(definitionTextAsset.text); - AddCollectionToFactory(collection); - } + AddToFactoryWithJSON(definitionTextAsset.text); + } + + public void AddToFactoryWithJSON(string definitionJSONText) + { + VMCollection collectionDefinition = JsonUtility.FromJson(definitionJSONText); + AddCollectionToFactory(collectionDefinition); } public void Reset() => _collections?.Clear(); @@ -70,7 +73,7 @@ namespace Syntriax.Modules.Movement.Config public void AddCollectionToFactory(VMCollection collection) { if (Collections.ContainsKey(collection.Name)) - throw new System.ArgumentException($"{ collection.Name } is already in the { Name }"); + throw new System.ArgumentException($"{collection.Name} is already in the {Name}"); Collections.Add(collection.Name, collection); } @@ -88,14 +91,14 @@ namespace Syntriax.Modules.Movement.Config if (string.IsNullOrEmpty(type.Namespace)) return type.Name; - return $"{ type.Namespace }.{ type.Name }"; + return $"{type.Namespace}.{type.Name}"; } #if UNITY_EDITOR public void SaveCollection(VMCollection collection) { string jsonText = JsonUtility.ToJson(collection, true); - string path = $"Assets/Resources/{ ResourceDirectoryToCollections }{collection.Name}.json"; + string path = $"Assets/Resources/{ResourceDirectoryToCollections}{collection.Name}.json"; System.IO.File.WriteAllText(path, jsonText); } #endif