Folder/Namespace Structure Improvements
This commit is contained in:
parent
713fb0188d
commit
b93c966218
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 15528ebd51d27d54398c55826710f23e
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,40 @@
|
||||||
|
using Syntriax.Modules.Movement.ColliderTrigger;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Syntriax.Modules.Movement.Implementations.TwoDimensional
|
||||||
|
{
|
||||||
|
public class OneDirectional2DAirMovement : OneDirectional2DMovementBase
|
||||||
|
{
|
||||||
|
protected override float moveValue { get; set; } = 0f;
|
||||||
|
protected IGroundTrigger groundTrigger = null;
|
||||||
|
|
||||||
|
protected override void Start()
|
||||||
|
{
|
||||||
|
base.Start();
|
||||||
|
groundTrigger = GetComponentInChildren<IGroundTrigger>();
|
||||||
|
groundTrigger.OnTriggered.AddListener(OnGroundTrigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGroundTrigger(bool isGrounded)
|
||||||
|
=> CanTakeOver = !isGrounded;
|
||||||
|
|
||||||
|
public override void ApplyMovement()
|
||||||
|
{
|
||||||
|
Vector2 velocity = rigid.velocity;
|
||||||
|
velocity.x += moveValue * Time.fixedDeltaTime;
|
||||||
|
|
||||||
|
if (moveValue != 0f)
|
||||||
|
{
|
||||||
|
if (Mathf.Abs(velocity.x) > Mathf.Abs(moveValue))
|
||||||
|
velocity.x = moveValue;
|
||||||
|
else if (Mathf.Abs(velocity.x - moveValue) > Mathf.Abs(moveValue))
|
||||||
|
velocity.x += moveValue * Time.fixedDeltaTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
rigid.velocity = velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDeactivated() { }
|
||||||
|
protected override void OnActivated() { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
using Syntriax.Modules.Movement.ColliderTrigger;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Syntriax.Modules.Movement.Implementations.TwoDimensional
|
||||||
|
{
|
||||||
|
public class OneDirectional2DGroundMovement : OneDirectional2DMovementBase
|
||||||
|
{
|
||||||
|
protected override float moveValue { get; set; } = 0f;
|
||||||
|
protected IGroundTrigger groundTrigger = null;
|
||||||
|
|
||||||
|
protected override void Start()
|
||||||
|
{
|
||||||
|
base.Start();
|
||||||
|
groundTrigger = GetComponentInChildren<IGroundTrigger>();
|
||||||
|
groundTrigger.OnTriggered.AddListener(OnGroundTrigger);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGroundTrigger(bool isGrounded)
|
||||||
|
=> CanTakeOver = isGrounded;
|
||||||
|
|
||||||
|
public override void ApplyMovement()
|
||||||
|
{
|
||||||
|
Vector2 velocity = rigid.velocity;
|
||||||
|
velocity.x = moveValue;
|
||||||
|
rigid.velocity = velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDeactivated() { }
|
||||||
|
protected override void OnActivated() { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Syntriax.Modules.Movement.Implementations.TwoDimensional
|
||||||
|
{
|
||||||
|
public abstract class OneDirectional2DMovementBase : TwoDimensionalMovementBase
|
||||||
|
{
|
||||||
|
protected abstract float moveValue { get; set; }
|
||||||
|
|
||||||
|
public override void Move(float x = 0, float y = 0, float z = 0)
|
||||||
|
=> moveValue = x * BaseSpeed * MovementMultiplier;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
using Syntriax.Modules.Movement.ColliderTrigger;
|
using Syntriax.Modules.Movement.ColliderTrigger;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.TwoDimensionalImplementations
|
namespace Syntriax.Modules.Movement.Implementations.TwoDimensional
|
||||||
{
|
{
|
||||||
public class OneWay2DAirMovement : OneWay2DMovementBase
|
public class OneWay2DAirMovement : OneWay2DMovementBase
|
||||||
{
|
{
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ccd6df43b281de34fb8ea893de8ec4c6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,7 +1,7 @@
|
||||||
using Syntriax.Modules.Movement.ColliderTrigger;
|
using Syntriax.Modules.Movement.ColliderTrigger;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.TwoDimensionalImplementations
|
namespace Syntriax.Modules.Movement.Implementations.TwoDimensional
|
||||||
{
|
{
|
||||||
public class OneWay2DGroundMovement : OneWay2DMovementBase
|
public class OneWay2DGroundMovement : OneWay2DMovementBase
|
||||||
{
|
{
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f7b798018f7cc444c92f7f17b0501bc7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Syntriax.Modules.Movement.TwoDimensionalImplementations
|
namespace Syntriax.Modules.Movement.Implementations.TwoDimensional
|
||||||
{
|
{
|
||||||
public abstract class OneWay2DMovementBase : TwoDimensionalMovementBase
|
public abstract class OneWay2DMovementBase : TwoDimensionalMovementBase
|
||||||
{
|
{
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 842775d6c36b58f40a18f3d930e04173
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -2,7 +2,7 @@ using Syntriax.Modules.Movement.State;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.TwoDimensionalImplementations
|
namespace Syntriax.Modules.Movement.Implementations.TwoDimensional
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(Rigidbody2D))]
|
[RequireComponent(typeof(Rigidbody2D))]
|
||||||
public abstract class TwoDimensionalMovementBase : MonoBehaviour, IMovement
|
public abstract class TwoDimensionalMovementBase : MonoBehaviour, IMovement
|
Loading…
Reference in New Issue