diff --git a/Assets/Goldenwere/GWSU/Controller/Character/InputSystemModule/Samples/SampleProject/Runtime/FakeControllerModule.cs b/Assets/Goldenwere/GWSU/Controller/Character/InputSystemModule/Samples/SampleProject/Runtime/FakeControllerModule.cs
index 507e64f..9e439cb 100644
--- a/Assets/Goldenwere/GWSU/Controller/Character/InputSystemModule/Samples/SampleProject/Runtime/FakeControllerModule.cs
+++ b/Assets/Goldenwere/GWSU/Controller/Character/InputSystemModule/Samples/SampleProject/Runtime/FakeControllerModule.cs
@@ -3,26 +3,41 @@ using Goldenwere.GWSU.CTRL.CHAR.Core;
namespace Goldenwere.GWSU.CTRL.CHAR.InputSystemModule.SampleProject
{
+ ///
+ /// Fake module to demonstrate the input module with
+ ///
public class FakeControllerModule : BaseControllerModule
{
[SerializeField] private BaseInputModule module;
+
+ [Header("Input Emitters")]
[SerializeField] private ScriptableObject emitterOnCrouch;
[SerializeField] private ScriptableObject emitterOnJump;
[SerializeField] private ScriptableObject emitterOnMovement;
+ /* actions */
private BaseModuleAction actionOnCrouch;
private BaseModuleAction actionOnJump;
private BaseModuleAction actionOnMovement;
+ /* state fields */
private Vector2 valueMovement;
+ private bool valueCrouched;
+ ///
+ /// Initializes the module on Awake
+ ///
private void Awake()
{
+ // Set up module actions by assigning emitters to the corresponding actions in the module
actionOnCrouch = new BaseModuleAction(OnCrouch, emitterOnCrouch, ModuleActionType.HeldOrPressed);
actionOnJump = new BaseModuleAction(OnJump, emitterOnJump, ModuleActionType.Pressed);
actionOnMovement = new BaseModuleAction(OnMovement, emitterOnMovement, ModuleActionType.Held);
}
+ ///
+ /// Registers actions on Enable
+ ///
private void OnEnable()
{
module.RegisterModuleAction(actionOnCrouch);
@@ -30,6 +45,9 @@ namespace Goldenwere.GWSU.CTRL.CHAR.InputSystemModule.SampleProject
module.RegisterModuleAction(actionOnMovement);
}
+ ///
+ /// Unregisters actions on Disable
+ ///
private void OnDisable()
{
module.UnregisterModuleAction(actionOnCrouch);
@@ -37,27 +55,46 @@ namespace Goldenwere.GWSU.CTRL.CHAR.InputSystemModule.SampleProject
module.UnregisterModuleAction(actionOnMovement);
}
+ ///
+ /// Handler for the crouch action
+ ///
private void OnCrouch()
{
- Debug.Log($"Crouched");
+ valueCrouched = !valueCrouched;
}
+ ///
+ /// Handler for the jump action
+ ///
private void OnJump()
{
Debug.Log("Jumped");
}
+ ///
+ /// Handler for the movement action
+ ///
+ /// The value of the input
private void OnMovement(Vector2 value)
{
valueMovement = value;
}
+ ///
+ /// Displays testing information to the screen
+ ///
private void OnGUI()
{
+ int size = Screen.height / 32;
GUI.Label(
- new Rect(10, 10, Screen.width - 10, 64),
- $"{valueMovement}",
- new GUIStyle { fontSize = 64 }
+ new Rect(10, 10, Screen.width - 10, size),
+ $"Movement: {valueMovement}",
+ new GUIStyle { fontSize = size }
+ );
+ GUI.Label(
+ new Rect(10, 10 + size, Screen.width - 10, size),
+ $"Crouched: {valueCrouched}",
+ new GUIStyle { fontSize = size }
);
}
}