From 1139293328a625dedde91bcfe954fdd25f4b6b1a Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sat, 19 Feb 2022 15:03:06 +0300 Subject: [PATCH] Variable Movement Added --- VariableMovement.meta | 8 ++++++ .../DefaulVariableMovementAsset.cs | 9 ++++++ .../DefaulVariableMovementAsset.cs.meta | 11 ++++++++ VariableMovement/IVariableMovement.cs | 7 +++++ VariableMovement/IVariableMovement.cs.meta | 11 ++++++++ VariableMovement/IVariableMovementAsset.cs | 8 ++++++ .../IVariableMovementAsset.cs.meta | 11 ++++++++ .../IVariableMovementController.cs | 10 +++++++ .../IVariableMovementController.cs.meta | 11 ++++++++ VariableMovement/SimpleImplemantation.meta | 8 ++++++ .../SimpleVariableMovement.cs | 11 ++++++++ .../SimpleVariableMovement.cs.meta | 11 ++++++++ .../SimpleVariableMovementAsset.cs | 13 +++++++++ .../SimpleVariableMovementAsset.cs.meta | 11 ++++++++ .../SimpleVariableMovementController.cs | 28 +++++++++++++++++++ .../SimpleVariableMovementController.cs.meta | 11 ++++++++ 16 files changed, 179 insertions(+) create mode 100644 VariableMovement.meta create mode 100644 VariableMovement/DefaulVariableMovementAsset.cs create mode 100644 VariableMovement/DefaulVariableMovementAsset.cs.meta create mode 100644 VariableMovement/IVariableMovement.cs create mode 100644 VariableMovement/IVariableMovement.cs.meta create mode 100644 VariableMovement/IVariableMovementAsset.cs create mode 100644 VariableMovement/IVariableMovementAsset.cs.meta create mode 100644 VariableMovement/IVariableMovementController.cs create mode 100644 VariableMovement/IVariableMovementController.cs.meta create mode 100644 VariableMovement/SimpleImplemantation.meta create mode 100644 VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs create mode 100644 VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs.meta create mode 100644 VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs create mode 100644 VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs.meta create mode 100644 VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs create mode 100644 VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs.meta diff --git a/VariableMovement.meta b/VariableMovement.meta new file mode 100644 index 0000000..9187881 --- /dev/null +++ b/VariableMovement.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f05a188c063295a459be521ca7cb5edb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/DefaulVariableMovementAsset.cs b/VariableMovement/DefaulVariableMovementAsset.cs new file mode 100644 index 0000000..a4be91c --- /dev/null +++ b/VariableMovement/DefaulVariableMovementAsset.cs @@ -0,0 +1,9 @@ +namespace Syntriax.Modules.Movement.VariableMovement +{ + public class DefaulVariableMovementAsset : IVariableMovementAsset + { + public string MovementName => "Default Movement"; + + public float MovementMultiplier { get; } = 1f; + } +} diff --git a/VariableMovement/DefaulVariableMovementAsset.cs.meta b/VariableMovement/DefaulVariableMovementAsset.cs.meta new file mode 100644 index 0000000..ba10dbd --- /dev/null +++ b/VariableMovement/DefaulVariableMovementAsset.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 51c6b19fd2c0c9f4e9a0b28528c875dd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/IVariableMovement.cs b/VariableMovement/IVariableMovement.cs new file mode 100644 index 0000000..4063934 --- /dev/null +++ b/VariableMovement/IVariableMovement.cs @@ -0,0 +1,7 @@ +namespace Syntriax.Modules.Movement.VariableMovement +{ + public interface IVariableMovement : IState + { + IVariableMovementAsset VariableMovementAsset { get; } + } +} diff --git a/VariableMovement/IVariableMovement.cs.meta b/VariableMovement/IVariableMovement.cs.meta new file mode 100644 index 0000000..6f012be --- /dev/null +++ b/VariableMovement/IVariableMovement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f5b11f55ed07dd9428e35c40af90714d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/IVariableMovementAsset.cs b/VariableMovement/IVariableMovementAsset.cs new file mode 100644 index 0000000..6978ad3 --- /dev/null +++ b/VariableMovement/IVariableMovementAsset.cs @@ -0,0 +1,8 @@ +namespace Syntriax.Modules.Movement.VariableMovement +{ + public interface IVariableMovementAsset + { + string MovementName { get; } + float MovementMultiplier { get; } + } +} diff --git a/VariableMovement/IVariableMovementAsset.cs.meta b/VariableMovement/IVariableMovementAsset.cs.meta new file mode 100644 index 0000000..f8b0f07 --- /dev/null +++ b/VariableMovement/IVariableMovementAsset.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 18c50e4da3596b64d9cd3a01ab22a2ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/IVariableMovementController.cs b/VariableMovement/IVariableMovementController.cs new file mode 100644 index 0000000..9790af0 --- /dev/null +++ b/VariableMovement/IVariableMovementController.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Syntriax.Modules.Movement.VariableMovement +{ + public interface IVariableMovementController : IState + { + List VariableMovements { get; } + IVariableMovement CurrentVariableMovement { get; } + } +} diff --git a/VariableMovement/IVariableMovementController.cs.meta b/VariableMovement/IVariableMovementController.cs.meta new file mode 100644 index 0000000..b3d8544 --- /dev/null +++ b/VariableMovement/IVariableMovementController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a04461d521f1e754f85154d2548da368 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/SimpleImplemantation.meta b/VariableMovement/SimpleImplemantation.meta new file mode 100644 index 0000000..081577f --- /dev/null +++ b/VariableMovement/SimpleImplemantation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc3b3517b04c51746a6f678728212d27 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs b/VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs new file mode 100644 index 0000000..5a0772f --- /dev/null +++ b/VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs @@ -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; + } +} diff --git a/VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs.meta b/VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs.meta new file mode 100644 index 0000000..42f418c --- /dev/null +++ b/VariableMovement/SimpleImplemantation/SimpleVariableMovement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 05bc4dd9eef91cf4b82018ce47c7b9c9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs b/VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs new file mode 100644 index 0000000..d84ef74 --- /dev/null +++ b/VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs @@ -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; + } +} diff --git a/VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs.meta b/VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs.meta new file mode 100644 index 0000000..03f8557 --- /dev/null +++ b/VariableMovement/SimpleImplemantation/SimpleVariableMovementAsset.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f0b94067bad67de4689a6a41749e1b1b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs b/VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs new file mode 100644 index 0000000..647e256 --- /dev/null +++ b/VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs @@ -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 VariableMovements { get; protected set; } = new List(); + public IVariableMovement CurrentVariableMovement + { + get + { + if (!StateEnabled) + return DefaultVariableMovement; + + foreach (IVariableMovement variableMovement in VariableMovements) + if (variableMovement.StateEnabled) + return variableMovement; + + return DefaultVariableMovement; + } + } + } +} diff --git a/VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs.meta b/VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs.meta new file mode 100644 index 0000000..449e76d --- /dev/null +++ b/VariableMovement/SimpleImplemantation/SimpleVariableMovementController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 580058b11e72667419d381dbffba60e8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: