AddToFactoryWithJson() Added to Factories + Rename

This commit is contained in:
Syntriax 2022-04-04 18:28:10 +03:00
parent c4edfef458
commit 5e0b7692b2
6 changed files with 21 additions and 15 deletions

View File

@ -1,7 +1,7 @@
using Syntriax.Modules.Movement.ColliderTrigger;
using UnityEngine;
namespace Syntriax.Modules.Movement
namespace Syntriax.Modules.Movement.TwoDimensionalImplementations
{
public class OneWay2DAirMovement : OneWay2DMovementBase
{

View File

@ -1,7 +1,7 @@
using Syntriax.Modules.Movement.ColliderTrigger;
using UnityEngine;
namespace Syntriax.Modules.Movement
namespace Syntriax.Modules.Movement.TwoDimensionalImplementations
{
public class OneWay2DGroundMovement : OneWay2DMovementBase
{

View File

@ -1,4 +1,4 @@
namespace Syntriax.Modules.Movement
namespace Syntriax.Modules.Movement.TwoDimensionalImplementations
{
public abstract class OneWay2DMovementBase : TwoDimensionalMovementBase
{

View File

@ -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

View File

@ -50,10 +50,13 @@ namespace Syntriax.Modules.Movement.Config
Reset();
foreach (TextAsset definitionTextAsset in UnityEngine.Resources.LoadAll<TextAsset>(ResourceDirectoryToDefinitions))
{
MovementDefinition movementDefinition = JsonUtility.FromJson<MovementDefinition>(definitionTextAsset.text);
AddDefinitionToFactory(movementDefinition);
AddToFactoryWithJSON(definitionTextAsset.text);
}
public void AddToFactoryWithJSON(string definitionJSONText)
{
MovementDefinition movementDefinition = JsonUtility.FromJson<MovementDefinition>(definitionJSONText);
AddDefinitionToFactory(movementDefinition);
}
public void Reset() => _definitions?.Clear();

View File

@ -53,10 +53,13 @@ namespace Syntriax.Modules.Movement.Config
Reset();
foreach (TextAsset definitionTextAsset in UnityEngine.Resources.LoadAll<TextAsset>(ResourceDirectoryToCollections))
{
VMCollection collection = JsonUtility.FromJson<VMCollection>(definitionTextAsset.text);
AddCollectionToFactory(collection);
AddToFactoryWithJSON(definitionTextAsset.text);
}
public void AddToFactoryWithJSON(string definitionJSONText)
{
VMCollection collectionDefinition = JsonUtility.FromJson<VMCollection>(definitionJSONText);
AddCollectionToFactory(collectionDefinition);
}
public void Reset() => _collections?.Clear();