Compare commits
4 Commits
b5198d1048
...
1c06272bf6
Author | SHA1 | Date |
---|---|---|
Syntriax | 1c06272bf6 | |
Syntriax | c903602e3b | |
Syntriax | c244ddeb98 | |
Syntriax | e95462af00 |
|
@ -75,7 +75,7 @@ namespace Syntriax.Modules.Movement.Editor
|
||||||
|
|
||||||
movementDefinition.MovementConfigs = new MovementConfig[]
|
movementDefinition.MovementConfigs = new MovementConfig[]
|
||||||
{
|
{
|
||||||
new MovementConfig(typeof(Implementations.GroundMovement1D).FullName, 5f)
|
new MovementConfig(typeof(Samples.GroundMovement1D).FullName, 5f)
|
||||||
};
|
};
|
||||||
|
|
||||||
movementDefinition.MonoBehaviours = new string[]
|
movementDefinition.MonoBehaviours = new string[]
|
||||||
|
@ -92,8 +92,8 @@ namespace Syntriax.Modules.Movement.Editor
|
||||||
|
|
||||||
movementDefinition.MovementConfigs = new MovementConfig[]
|
movementDefinition.MovementConfigs = new MovementConfig[]
|
||||||
{
|
{
|
||||||
new MovementConfig(typeof(Implementations.AirMovement1D).FullName, 5f),
|
new MovementConfig(typeof(Samples.AirMovement1D).FullName, 5f),
|
||||||
new MovementConfig(typeof(Implementations.GroundMovement1D).FullName, 5f)
|
new MovementConfig(typeof(Samples.GroundMovement1D).FullName, 5f)
|
||||||
};
|
};
|
||||||
|
|
||||||
movementDefinition.MonoBehaviours = new string[]
|
movementDefinition.MonoBehaviours = new string[]
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"references": [
|
"references": [
|
||||||
"GUID:d4c952ed5f59c5a449cda1b0080ed841",
|
"GUID:d4c952ed5f59c5a449cda1b0080ed841",
|
||||||
"GUID:efa9a9bc94c60c74684aafb7428fbf61",
|
"GUID:efa9a9bc94c60c74684aafb7428fbf61",
|
||||||
"GUID:c967acc4be781ca44b42a1887eb1ac7a"
|
"GUID:c967acc4be781ca44b42a1887eb1ac7a",
|
||||||
|
"GUID:863b8995abde2cf40b8b4cb709452a32"
|
||||||
],
|
],
|
||||||
"includePlatforms": [
|
"includePlatforms": [
|
||||||
"Editor"
|
"Editor"
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.Implementations
|
namespace Syntriax.Modules.Movement
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IMovement" with no implementation, added by <see cref="MovementController" by default as a fallback implementation/>/>
|
||||||
|
/// </summary>
|
||||||
public class DefaultMovement : MovementBase
|
public class DefaultMovement : MovementBase
|
||||||
{
|
{
|
||||||
public override void ApplyMovement() { }
|
public override void ApplyMovement() { }
|
|
@ -7,9 +7,9 @@ namespace Syntriax.Modules.Movement
|
||||||
public interface IMovementController
|
public interface IMovementController
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Member Toggle State
|
/// Member <see cref="IToggleState"/> to switch on or off
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IToggleState ToggleState { get; }
|
IToggleState ToggleStateMember { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Currently active <see cref="IMovement"/>
|
/// Currently active <see cref="IMovement"/>
|
||||||
|
|
|
@ -31,24 +31,24 @@ namespace Syntriax.Modules.Movement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool areBothToggleStatesToggled => ToggleState.IsToggledNullChecked() && toggleStateOnGameObject.IsToggledNullChecked();
|
private bool areBothToggleStatesToggled => ToggleStateMember.IsToggledNullChecked() && toggleStateOnGameObject.IsToggledNullChecked();
|
||||||
|
|
||||||
public List<IMovement> Movements { get; protected set; } = new List<IMovement>(32);
|
public List<IMovement> Movements { get; protected set; } = new List<IMovement>(32);
|
||||||
|
|
||||||
public IToggleState ToggleState { get; protected set; } = new ToggleStateMember(true);
|
public IToggleState ToggleStateMember { get; protected set; } = new ToggleStateMember(true);
|
||||||
|
|
||||||
protected IToggleState toggleStateOnGameObject = null;
|
protected IToggleState toggleStateOnGameObject = null;
|
||||||
|
|
||||||
protected virtual void Start()
|
protected virtual void Start()
|
||||||
{
|
{
|
||||||
if (GetComponent<Implementations.DefaultMovement>() == null)
|
if (GetComponent<DefaultMovement>() == null)
|
||||||
gameObject.AddComponent<Implementations.DefaultMovement>();
|
gameObject.AddComponent<DefaultMovement>();
|
||||||
|
|
||||||
RecacheMovements();
|
RecacheMovements();
|
||||||
toggleStateOnGameObject = GetComponent<IToggleState>();
|
toggleStateOnGameObject = GetComponent<IToggleState>();
|
||||||
|
|
||||||
toggleStateOnGameObject.OnToggleStateChanged += (_) => InvokeOnMoveAction();
|
toggleStateOnGameObject.OnToggleStateChanged += (_) => InvokeOnMoveAction();
|
||||||
ToggleState.OnToggleStateChanged += (_) => InvokeOnMoveAction();
|
ToggleStateMember.OnToggleStateChanged += (_) => InvokeOnMoveAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void FixedUpdate()
|
protected virtual void FixedUpdate()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 15528ebd51d27d54398c55826710f23e
|
guid: 231b2d16dd7862d41bc2111d759f6ca2
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
|
@ -1,7 +1,7 @@
|
||||||
using Syntriax.Modules.Trigger;
|
using Syntriax.Modules.Trigger;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.Implementations
|
namespace Syntriax.Modules.Movement.Samples
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(Rigidbody2D))]
|
[RequireComponent(typeof(Rigidbody2D))]
|
||||||
public class AirMovement1D : MovementBase1D
|
public class AirMovement1D : MovementBase1D
|
||||||
|
@ -19,7 +19,7 @@ namespace Syntriax.Modules.Movement.Implementations
|
||||||
|
|
||||||
if (groundTrigger != null)
|
if (groundTrigger != null)
|
||||||
{
|
{
|
||||||
groundTrigger.OnTriggered += OnGroundTrigger;
|
groundTrigger.OnTriggerStateChanged += OnGroundTrigger;
|
||||||
CanTakeOver = false;
|
CanTakeOver = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
using Syntriax.Modules.Trigger;
|
using Syntriax.Modules.Trigger;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.Implementations
|
namespace Syntriax.Modules.Movement.Samples
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(Rigidbody2D))]
|
[RequireComponent(typeof(Rigidbody2D))]
|
||||||
public class GroundMovement1D : MovementBase1D
|
public class GroundMovement1D : MovementBase1D
|
||||||
|
@ -21,7 +21,7 @@ namespace Syntriax.Modules.Movement.Implementations
|
||||||
|
|
||||||
if (groundTrigger != null)
|
if (groundTrigger != null)
|
||||||
{
|
{
|
||||||
groundTrigger.OnTriggered += OnGroundTrigger;
|
groundTrigger.OnTriggerStateChanged += OnGroundTrigger;
|
||||||
CanTakeOver = false;
|
CanTakeOver = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "Syntriax.Modules.Movement.Samples",
|
||||||
|
"rootNamespace": "",
|
||||||
|
"references": [
|
||||||
|
"GUID:efa9a9bc94c60c74684aafb7428fbf61",
|
||||||
|
"GUID:1f5f15fe7e49bdb48a76c5ce9b1c9f2f",
|
||||||
|
"GUID:d4c952ed5f59c5a449cda1b0080ed841",
|
||||||
|
"GUID:c967acc4be781ca44b42a1887eb1ac7a"
|
||||||
|
],
|
||||||
|
"includePlatforms": [],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": true,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 863b8995abde2cf40b8b4cb709452a32
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "com.syntriax.movement",
|
"name": "com.syntriax.movement",
|
||||||
"version": "0.1.2",
|
"version": "0.1.4",
|
||||||
"displayName": "Movement Module",
|
"displayName": "Movement Module",
|
||||||
"description": "Dependends On:\nhttps://git.syntriax.com/Syntriax/ToggleState.git\nhttps://git.syntriax.com/Syntriax/Trigger.git\nhttps://git.syntriax.com/Syntriax/Factory.git",
|
"description": "Dependends On:\nhttps://git.syntriax.com/Syntriax/ToggleState.git\nhttps://git.syntriax.com/Syntriax/Trigger.git\nhttps://git.syntriax.com/Syntriax/Factory.git",
|
||||||
"unity": "2019.1",
|
"unity": "2019.1",
|
||||||
"documentationUrl": "https://git.syntriax.com/Syntriax/Movement.git",
|
"documentationUrl": "https://git.syntriax.com/Syntriax/Movement.git",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.syntriax.toggle-state": "0.1.0",
|
"com.syntriax.toggle-state": "0.1.0",
|
||||||
"com.syntriax.trigger": "0.1.0",
|
"com.syntriax.trigger": "0.2.0",
|
||||||
"com.syntriax.factory": "0.1.0"
|
"com.syntriax.factory": "0.1.0"
|
||||||
},
|
},
|
||||||
"keywords": ["Movement"],
|
"keywords": ["Movement"],
|
||||||
|
|
Loading…
Reference in New Issue