Movement (Work In Progress)
Installation
UPM
- Add the UPM registry. Click on the Editmenu, then selectProject settings..., selectPackage Manager, and add a scoped registry:- Name: Syntriax
- Url: https://upm.syntriax.com
- Scopes:
- com.syntriax
 
 
- Name: 
The UPM registry also has proxies to OpenUPM, so you can add scopes from there too.
Manual
- Navigate into Package Managerand press on the+button, chooseAdd package from git URL...and add:- https://git.syntriax.com/Syntriax/State
- https://git.syntriax.com/Syntriax/Trigger
- https://git.syntriax.com/Syntriax/Factory
- https://git.syntriax.com/Syntriax/Movement
 
Dependencies
- State Module (https://git.syntriax.com/Syntriax/State)
- Trigger Module (https://git.syntriax.com/Syntriax/Trigger)
- Factory Module (https://git.syntriax.com/Syntriax/Factory)
Getting Started 2D
Automaticaly
Custom The Editor
- Find the button on the Unity Editor's top panel named Syntriax, UnderModules/Movementopen the windowDefinition Creator
- You can find two buttons for both QuickandLongerpresets, or you can define your own, then pressCreatebutton
- Add MovementDefinitionAppliercomponent to your PlayerGameObject
- Put the name of the definition you created in the first step to Startup Definition Namefield- You can also call MovementDefinitionApplier.LoadDefinitionmethod manually to load them via anoher script.
 
- You can also call 
- Connect your inputs to the MovementController(Example with Input System)
Manually
Quick
- Clone the module to a folder in your Assets folder
- Add MovementControllercomponent to your PlayerGameObject
- Add GroundMovement1Dcomponent to your PlayerGameObject
- Connect your inputs to the MovementController(Example with Input System)
Longer
- Clone the module to a folder in your Assets folder
- Add StateEnableMonoBehaviourcomponent to your PlayerGameObject
- Add MovementControllercomponent to your PlayerGameObject
- Add AirMovement1Dcomponent to your PlayerGameObject
- Add GroundMovement1Dcomponent to your PlayerGameObject(make sure it's bellowAirMovement1D)
- Add a new empty child GameObjectand addBox2DGroundTrigger&GroundTriggercomponent to it and place and resize it under the player for ground detection, optionally you can set theCollisionMaskfield on it to make sure it only detects specific layers
- Connect your inputs to the MovementController(Example with Input System)
- (Optional) Add a jumping script to see the effects better
This should give you a movement where you can disable the controller through the IStateEnable, and you should be able to see a the movement changes when the character is not touching the ground.
You can add your own movement implementations with bases under the Bases folder, or straight up from the IMovement interface.
Or if you want you can write your own MovementController with using the IMovementController interface, too, but it should be enough for most cases.
Input System Example
using Syntriax.Modules.Movement;
using UnityEngine;
using UnityEngine.InputSystem;
public class MovementInputs : MonoBehaviour, Inputs.IMovementActions
{
  private Inputs inputs = null;
  private IMovementController movementController = null;
  public void OnMovement(InputAction.CallbackContext context) =>
    movementController.Move(context.ReadValue<Vector2>());
  private void OnEnable()
  {
    if (inputs == null)
    {
      inputs = new Inputs();
      inputs.Movement.SetCallbacks(this);
    }
    movementController =
      movementController ?? FindObjectOfType<IMovementController>();
    inputs.Enable();
  }
  private void OnDisable()
  {
    inputs.Disable();
  }
}
Description
				
					Languages
				
				
								
								
									C#
								
								100%