Variable Movement Added

This commit is contained in:
Syntriax 2022-02-19 15:03:06 +03:00
parent 2c996a9a29
commit 1139293328
16 changed files with 179 additions and 0 deletions

8
VariableMovement.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f05a188c063295a459be521ca7cb5edb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
namespace Syntriax.Modules.Movement.VariableMovement
{
public class DefaulVariableMovementAsset : IVariableMovementAsset
{
public string MovementName => "Default Movement";
public float MovementMultiplier { get; } = 1f;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51c6b19fd2c0c9f4e9a0b28528c875dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
namespace Syntriax.Modules.Movement.VariableMovement
{
public interface IVariableMovement : IState
{
IVariableMovementAsset VariableMovementAsset { get; }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f5b11f55ed07dd9428e35c40af90714d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
namespace Syntriax.Modules.Movement.VariableMovement
{
public interface IVariableMovementAsset
{
string MovementName { get; }
float MovementMultiplier { get; }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 18c50e4da3596b64d9cd3a01ab22a2ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace Syntriax.Modules.Movement.VariableMovement
{
public interface IVariableMovementController : IState
{
List<IVariableMovement> VariableMovements { get; }
IVariableMovement CurrentVariableMovement { get; }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a04461d521f1e754f85154d2548da368
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bc3b3517b04c51746a6f678728212d27
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
namespace Syntriax.Modules.Movement.VariableMovement.SimpleImplementation
{
public class SimpleVariableMovement : IVariableMovement
{
public IVariableMovementAsset VariableMovementAsset { get; protected set; } = null;
public bool StateEnabled { get; set; } = false;
public SimpleVariableMovement(IVariableMovementAsset variableMovementAsset)
=> VariableMovementAsset = variableMovementAsset;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 05bc4dd9eef91cf4b82018ce47c7b9c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,13 @@
using UnityEngine;
namespace Syntriax.Modules.Movement.VariableMovement.SimpleImplementation
{
[CreateAssetMenu(fileName = "Simple Variable Movement Asset", menuName = "Syntriax/Modules/Movement/VariableMovement/Simple Variable Movement Asset", order = 0)]
public class SimpleVariableMovementAsset : ScriptableObject, IVariableMovementAsset
{
[SerializeField] protected float movementMultiplier = 1f;
public string MovementName => this.name;
public float MovementMultiplier => movementMultiplier;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f0b94067bad67de4689a6a41749e1b1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using System.Collections.Generic;
using UnityEngine;
namespace Syntriax.Modules.Movement.VariableMovement.SimpleImplementation
{
public class SimpleVariableMovementController : MonoBehaviour, IVariableMovementController
{
private static IVariableMovement DefaultVariableMovement = new SimpleVariableMovement(new DefaulVariableMovementAsset());
public bool StateEnabled { get; set; } = false;
public List<IVariableMovement> VariableMovements { get; protected set; } = new List<IVariableMovement>();
public IVariableMovement CurrentVariableMovement
{
get
{
if (!StateEnabled)
return DefaultVariableMovement;
foreach (IVariableMovement variableMovement in VariableMovements)
if (variableMovement.StateEnabled)
return variableMovement;
return DefaultVariableMovement;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 580058b11e72667419d381dbffba60e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: