added action belt

This commit is contained in:
Nilton Constantino 2026-06-09 17:07:43 +01:00
parent 648bfcdb23
commit f31e642009
No known key found for this signature in database
29 changed files with 9581 additions and 41 deletions

View File

@ -0,0 +1,24 @@
using System.Collections.Generic;
using Intrepid.Diagnostics;
using Intrepid.Gameplay.Entities.Player.ActionBelt;
using Intrepid.Localization;
using Intrepid.Utilities;
using UnityEngine;
namespace __Prototype.Scripts
{
public class DebugActionCallable : ActionCallable
{
[GroupConfigurations, SerializeField] private LocalizationTag actionLocalization;
[GroupConfigurations, SerializeField] private LocalizationTag descriptionLocalization;
protected override LocalizationTag ActionLocalization => actionLocalization;
protected override LocalizationTag DescriptionLocalization => descriptionLocalization;
protected override List<string> Parameters => new();
protected override void Execute(ActionIdentifier identifier)
{
DLogger.LogDebug($"DebugActionCallable invoked {identifier}");
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f6b190fcf987495d91766160395d282b
timeCreated: 1781007541

View File

@ -11,6 +11,15 @@ namespace __Prototype.Scripts
[GroupConfigurations, SerializeField] private Color color = Color.orange; [GroupConfigurations, SerializeField] private Color color = Color.orange;
private static readonly int BaseColor = Shader.PropertyToID("_BaseColor"); private static readonly int BaseColor = Shader.PropertyToID("_BaseColor");
public Color Color
{
get => color;
set
{
color = value;
Paint();
}
}
private void Awake() private void Awake()
{ {

View File

@ -0,0 +1,44 @@
using System.Collections.Generic;
using Intrepid.Gameplay.Entities.Player.ActionBelt;
using Intrepid.Localization;
using Intrepid.Utilities;
using UnityEngine;
namespace __Prototype.Scripts
{
[RequireComponent(typeof(MeshColorSetter))]
public class SwitchActionCallable : ActionCallable
{
[GroupConfigurations, SerializeField] private LocalizationTag actionLocalizationOn;
[GroupConfigurations, SerializeField] private LocalizationTag actionLocalizationOff;
[GroupConfigurations, SerializeField] private LocalizationTag descriptionLocalization;
private MeshColorSetter Setter { get; set; }
private bool IsSwitchOn { get; set; } = true;
protected override LocalizationTag ActionLocalization => IsSwitchOn ? actionLocalizationOff : actionLocalizationOn;
protected override LocalizationTag DescriptionLocalization => descriptionLocalization;
protected override List<string> Parameters => new();
private void Awake()
{
Setter = GetComponent<MeshColorSetter>();
IsSwitchOn = true;
Setter.Color = Color.yellow;
}
protected override void Execute(ActionIdentifier identifier)
{
if (IsSwitchOn)
{
IsSwitchOn = false;
Setter.Color = Color.black;
}
else
{
IsSwitchOn = true;
Setter.Color = Color.yellow;
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b3403b8e5b164907a7f2e9a2b86ff4e3
timeCreated: 1781019366

View File

@ -15,3 +15,5 @@ MonoBehaviour:
availableLocalizations: availableLocalizations:
- {fileID: 11400000, guid: 3d67344845ff542698158de5abc1a584, type: 2} - {fileID: 11400000, guid: 3d67344845ff542698158de5abc1a584, type: 2}
- {fileID: 11400000, guid: 0f0975e93a36b46e297f37ea87b9e304, type: 2} - {fileID: 11400000, guid: 0f0975e93a36b46e297f37ea87b9e304, type: 2}
- {fileID: 11400000, guid: ac4664e57f08d44b69e670c2bd07a259, type: 2}
- {fileID: 11400000, guid: e166ae95e44e6476bb1810e3d1bafe8e, type: 2}

View File

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eaeccf28165740a7811bccb7b0b04f49, type: 3}
m_Name: action.switch-turn-off
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Localization.LocalizationTag
code: action.switch-turn-off

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ac4664e57f08d44b69e670c2bd07a259
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eaeccf28165740a7811bccb7b0b04f49, type: 3}
m_Name: action.switch-turn-on
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Localization.LocalizationTag
code: action.switch-turn-on

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e166ae95e44e6476bb1810e3d1bafe8e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -18,4 +18,6 @@ MonoBehaviour:
localizationPackages: localizationPackages:
- {fileID: 11400000, guid: c083bf168a33d4c828237ad264b59fe5, type: 2} - {fileID: 11400000, guid: c083bf168a33d4c828237ad264b59fe5, type: 2}
- {fileID: 11400000, guid: 5e5b05740525b4f8d88bae995fab156e, type: 2} - {fileID: 11400000, guid: 5e5b05740525b4f8d88bae995fab156e, type: 2}
- {fileID: 11400000, guid: 6d5320f6fa3794b1c86b40852b200de4, type: 2}
- {fileID: 11400000, guid: 7fa9250e68cb048de996dada5d821698, type: 2}
wildCardPackages: [] wildCardPackages: []

View File

@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 08dcb4b4947f420792e0d5969b2ace80, type: 3}
m_Name: English - action.switch-turn-off
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Localization.LocalizationPackage
tag: {fileID: 11400000, guid: ac4664e57f08d44b69e670c2bd07a259, type: 2}
disabled: 0
locked: 0
translation: Turn Off

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6d5320f6fa3794b1c86b40852b200de4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 08dcb4b4947f420792e0d5969b2ace80, type: 3}
m_Name: English - action.switch-turn-on
m_EditorClassIdentifier: Intrepid General Utilities::Intrepid.Localization.LocalizationPackage
tag: {fileID: 11400000, guid: e166ae95e44e6476bb1810e3d1bafe8e, type: 2}
disabled: 0
locked: 0
translation: Turn On

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7fa9250e68cb048de996dada5d821698
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@ -1,62 +1,40 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Intrepid.Core.Entities; using Intrepid.Core.Entities;
using Intrepid.Core.Tags; using Intrepid.Core.Tags;
using Intrepid.GameManagers; using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events; using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Gameplay.Entities.Player.Tags; using Intrepid.Gameplay.Entities.Player.Tags;
using Intrepid.Localization;
using Intrepid.Utilities; using Intrepid.Utilities;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; #if UNITY_EDITOR
using UnityEditor;
#endif
namespace Intrepid.Gameplay.Entities.Player.ActionBelt namespace Intrepid.Gameplay.Entities.Player.ActionBelt
{ {
[RequireComponent(typeof(SphereCollider))] [RequireComponent(typeof(SphereCollider))]
public class ActionBeltTrigger : EntityTrigger public class ActionBeltTrigger : EntityTrigger
{ {
[GroupConfigurations, SerializeField, EnumPaging, PropertyOrder(0)] private ActionCategory actionCategory = ActionCategory.General; [GroupConfigurations, SerializeField, PropertySpace, PropertyOrder(12)] private List<ActionCallable> callables;
[GroupConfigurations, SerializeField, ToggleLeft, PropertySpace, PropertyOrder(1)] private bool canBeDropped;
[GroupConfigurations, SerializeField, ToggleLeft, PropertySpace, PropertyOrder(2)] private bool shouldDropFromBeltWhenActivated;
[GroupConfigurations, SerializeField, PropertySpace, PropertyOrder(12)] private LocalizationTag actionLocalization;
[GroupConfigurations, SerializeField, PropertyOrder(13)] private LocalizationTag descriptionLocalization;
[GroupConfigurations, SerializeField, PropertyOrder(14)] private List<string> parameters = new();
[GroupConfigurations, SerializeField, PropertySpace, PropertyOrder(15)] private UnityEvent<ActionIdentifier> callback;
public SphereCollider Collider => (SphereCollider)MainCollider; public SphereCollider Collider => (SphereCollider)MainCollider;
public LocalizationTag Localization
{
get => descriptionLocalization;
set => descriptionLocalization = value;
}
public List<string> Parameters => parameters;
protected override void WhenRaiseEnterEvent(Collider other, EntitySensor entitySensor, List<BehaviourTag> behaviourTags) protected override void WhenRaiseEnterEvent(Collider other, EntitySensor entitySensor, List<BehaviourTag> behaviourTags)
{ {
if (entitySensor.EntityTag is PlayerTag playerTag) if (entitySensor.EntityTag is PlayerTag playerTag)
{ {
Proxy.Instance.EventBus.Raise(new ActionBeltAddEvent foreach (var callable in callables)
{ {
ActionBeltManger = playerTag.ActionBeltManger, if (callable.IsNull()) continue;
ActionEnvelope = new ActionEnvelope if (callable.IsNotEnabled) continue;
Proxy.Instance.EventBus.Raise(new ActionBeltAddEvent
{ {
ActionIdentifier = new ActionIdentifier ActionBeltManger = playerTag.ActionBeltManger,
{ ActionEnvelope = callable.BuildEnvelope(),
Id = Id, });
}, }
CanBeDropped = canBeDropped,
ActionCategory = actionCategory,
ActionLocalization = actionLocalization,
DescriptionLocalization = descriptionLocalization,
DescriptionParams = Functions.GetParams(parameters),
Callback = ActionIdentifier =>
{
callback?.Invoke(ActionIdentifier);
return ActionCategory.Terminal.Equals(actionCategory) || shouldDropFromBeltWhenActivated;
}
}
});
} }
} }
@ -64,12 +42,92 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
{ {
if (entitySensor.EntityTag is PlayerTag playerTag) if (entitySensor.EntityTag is PlayerTag playerTag)
{ {
Proxy.Instance.EventBus.Raise(new ActionBeltRemoveByIdEvent foreach (var callable in callables)
{ {
ActionBeltManger = playerTag.ActionBeltManger, Proxy.Instance.EventBus.Raise(new ActionBeltRemoveByIdEvent
ActionId = Id, {
}); ActionBeltManger = playerTag.ActionBeltManger,
ActionId = callable.Id,
});
}
} }
} }
#if UNITY_EDITOR
private static readonly Color CallableConnectionColor = new(1f, 0.72f, 0.12f, 1f);
private static readonly Color CallableConnectionShadowColor = new(0f, 0f, 0f, 0.35f);
private void OnDrawGizmosSelected()
{
DrawCallableConnections();
}
private void DrawCallableConnections()
{
if (callables == null || callables.Count == 0) return;
var from = GetGizmoOrigin();
foreach (var callable in callables)
{
if (callable.IsNull()) continue;
var to = callable.transform.position;
DrawGoldenConnection(from, to, callable.name);
}
}
private Vector3 GetGizmoOrigin()
{
if (Collider is not null)
{
return Collider.bounds.center;
}
return transform.position;
}
private static void DrawGoldenConnection(Vector3 from, Vector3 to, string label)
{
Handles.color = CallableConnectionShadowColor;
Handles.DrawAAPolyLine(6f, from, to);
Handles.color = CallableConnectionColor;
Handles.DrawAAPolyLine(3f, from, to);
DrawConnectionEndPoint(from);
DrawConnectionEndPoint(to);
var labelPosition = Vector3.Lerp(from, to, 0.5f);
DrawConnectionLabel(labelPosition, label);
}
private static void DrawConnectionEndPoint(Vector3 position)
{
Handles.color = CallableConnectionColor;
Handles.SphereHandleCap(
0,
position,
Quaternion.identity,
0.15f,
EventType.Repaint
);
}
private static void DrawConnectionLabel(Vector3 position, string label)
{
if (string.IsNullOrWhiteSpace(label))
return;
var style = new GUIStyle(EditorStyles.boldLabel)
{
normal =
{
textColor = CallableConnectionColor
}
};
Handles.Label(position + Vector3.up * 0.25f, label, style);
}
#endif
} }
} }

View File

@ -0,0 +1,51 @@
using System.Collections.Generic;
using Intrepid.Localization;
using Intrepid.Utilities;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Intrepid.Gameplay.Entities.Player.ActionBelt
{
public abstract class ActionCallable : Identification
{
[GroupConfigurations, SerializeField, EnumPaging] private ActionCategory actionCategory = ActionCategory.General;
[GroupConfigurations, SerializeField, ToggleLeft, PropertySpace] private bool canBeDropped;
[ShowIf("IsNotTerminal")]
[GroupConfigurations, SerializeField, ToggleLeft, PropertySpace] private bool shouldDropFromBeltWhenActivated;
private bool IsNotTerminal => actionCategory != ActionCategory.Terminal;
private ActionCategory ActionCategory => actionCategory;
private bool CanBeDropped => canBeDropped;
private bool ShouldDropFromBeltWhenActivated => shouldDropFromBeltWhenActivated;
protected virtual LocalizationTag ActionLocalization { get; }
protected virtual LocalizationTag DescriptionLocalization { get; }
protected virtual List<string> Parameters { get; }
public bool IsEnabled { get; protected set; } = true;
public bool IsNotEnabled => !IsEnabled;
protected abstract void Execute(ActionIdentifier identifier);
public virtual ActionEnvelope BuildEnvelope()
{
return new ActionEnvelope
{
ActionIdentifier = new ActionIdentifier
{
Id = Id,
},
CanBeDropped = CanBeDropped,
ActionCategory = ActionCategory,
ActionLocalization = ActionLocalization,
DescriptionLocalization = DescriptionLocalization,
DescriptionParams = Functions.GetParams(Parameters),
Callback = ai =>
{
Execute(ai);
return ActionCategory.Terminal.Equals(ActionCategory) || ShouldDropFromBeltWhenActivated;
}
};
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8d5b39bd342948b29b47e5dd10cab74f
timeCreated: 1781007017

View File

@ -3,5 +3,10 @@ namespace Intrepid.Gameplay.Entities.Player.ActionBelt
public class ActionIdentifier public class ActionIdentifier
{ {
public string Id { get; set; } public string Id { get; set; }
public override string ToString()
{
return $"{{ Id: {Id} }}";
}
} }
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using Intrepid.Core.Entities; using Intrepid.Core.Entities;
using Intrepid.Core.Entities.Messages; using Intrepid.Core.Entities.Messages;
using Intrepid.Gameplay.Entities.Player.ActionBelt;
using Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine; using Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine;
using Intrepid.Integration.Input; using Intrepid.Integration.Input;
using Intrepid.Structures; using Intrepid.Structures;
@ -11,6 +12,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
{ {
public class SentinelBrain : EntityBrain public class SentinelBrain : EntityBrain
{ {
[GroupInjections, SerializeField] private ActionBeltManager actionBeltManager;
[GroupInjections, SerializeField] private SentinelControls controls; [GroupInjections, SerializeField] private SentinelControls controls;
protected SentinelStateMachine StateMachine { get; private set; } protected SentinelStateMachine StateMachine { get; private set; }
@ -18,6 +20,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
public SentinelEntity Entity => RootEntity as SentinelEntity; public SentinelEntity Entity => RootEntity as SentinelEntity;
public SentinelInputs Inputs { get; private set; } public SentinelInputs Inputs { get; private set; }
public SentinelStateType CurrentState => StateMachine.CurrentImplementation.GetStateKey(); public SentinelStateType CurrentState => StateMachine.CurrentImplementation.GetStateKey();
public ActionBeltManager ActionBeltManager => actionBeltManager;
public SentinelControls Controls => controls; public SentinelControls Controls => controls;
protected override void InitializeVariables() protected override void InitializeVariables()

View File

@ -6,6 +6,9 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel
public class SentinelInputs public class SentinelInputs
{ {
public Func<Vector2> Movement { get; set; } public Func<Vector2> Movement { get; set; }
public Func<bool> Interact { get; set; }
public Func<bool> DPadLeft { get; set; }
public Func<bool> DPadRight { get; set; }
public Func<bool> Dash { get; set; } public Func<bool> Dash { get; set; }
// debug // debug

View File

@ -1,4 +1,6 @@
using Intrepid.Core.Entities; using Intrepid.Core.Entities;
using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine
{ {
@ -31,5 +33,38 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine
public virtual void RunOnFixedUpdate() public virtual void RunOnFixedUpdate()
{ {
} }
protected void VerifyInteraction()
{
if (!Brain.ActionBeltManager.IsOperational) return;
if (Brain.ActionBeltManager.IsEmpty) return;
if (Brain.Inputs.Interact())
{
Proxy.Instance.EventBus.Raise(new ActionBeltTakeActionEvent
{
ActionBeltManger = Brain.ActionBeltManager.ActionBeltManagerTag,
});
return;
}
var left = Brain.Inputs.DPadLeft();
var right = Brain.Inputs.DPadRight();
if (left && right) return;
if (left)
{
Proxy.Instance.EventBus.Raise(new ActionBeltNextLeftEvent
{
ActionBeltManger = Brain.ActionBeltManager.ActionBeltManagerTag,
});
}
if (right)
{
Proxy.Instance.EventBus.Raise(new ActionBeltNextRightEvent
{
ActionBeltManger = Brain.ActionBeltManager.ActionBeltManagerTag,
});
}
}
} }
} }

View File

@ -1,3 +1,5 @@
using Intrepid.GameManagers;
using Intrepid.Gameplay.Entities.Player.ActionBelt.Events;
using Intrepid.Structures; using Intrepid.Structures;
using Intrepid.Utilities; using Intrepid.Utilities;
using UnityEngine; using UnityEngine;
@ -30,6 +32,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
public override void RunOnUpdate() public override void RunOnUpdate()
{ {
Movement = Brain.Inputs.Movement(); Movement = Brain.Inputs.Movement();
VerifyInteraction();
if (CheckDash()) return; if (CheckDash()) return;
if (CheckMovement()) return; if (CheckMovement()) return;
} }

View File

@ -35,6 +35,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
{ {
Movement = Brain.Inputs.Movement(); Movement = Brain.Inputs.Movement();
Brain.Entity.ChangeOrientation(Movement); Brain.Entity.ChangeOrientation(Movement);
VerifyInteraction();
if (CheckDash()) return; if (CheckDash()) return;
if (CheckMovement()) return; if (CheckMovement()) return;
Brain.Entity.DesiredVelocity = Movement * speed; Brain.Entity.DesiredVelocity = Movement * speed;

View File

@ -35,6 +35,7 @@ namespace Intrepid.Gameplay.Entities.Player.Sentinel.StateMachine.States
{ {
Movement = Brain.Inputs.Movement(); Movement = Brain.Inputs.Movement();
Brain.Entity.ChangeOrientation(Movement); Brain.Entity.ChangeOrientation(Movement);
VerifyInteraction();
if (CheckDash()) return; if (CheckDash()) return;
if (CheckMovement()) return; if (CheckMovement()) return;
Brain.Entity.DesiredVelocity = Movement * speed; Brain.Entity.DesiredVelocity = Movement * speed;

View File

@ -101,6 +101,33 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""interactions"": """", ""interactions"": """",
""initialStateCheck"": true ""initialStateCheck"": true
}, },
{
""name"": ""Interact"",
""type"": ""Button"",
""id"": ""f0264441-a456-4101-8595-7a760a1a76c7"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""DPadLeft"",
""type"": ""Button"",
""id"": ""59874fde-0b05-4c43-ab94-2f610c20fa7c"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""DPadRight"",
""type"": ""Button"",
""id"": ""28db83e0-7ec7-4068-a414-99928dd3ab95"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{ {
""name"": ""Dash"", ""name"": ""Dash"",
""type"": ""Button"", ""type"": ""Button"",
@ -230,6 +257,72 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""action"": ""Reset"", ""action"": ""Reset"",
""isComposite"": false, ""isComposite"": false,
""isPartOfComposite"": false ""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""ce95f2f6-e4dd-43af-99e1-156acd6f7fba"",
""path"": ""<Gamepad>/buttonNorth"",
""interactions"": """",
""processors"": """",
""groups"": "";Gamepad"",
""action"": ""Interact"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""c255d0d2-61f6-42f8-ba50-a352926f0ac7"",
""path"": ""<Keyboard>/e"",
""interactions"": """",
""processors"": """",
""groups"": "";Keyboard & Mouse"",
""action"": ""Interact"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""6de8721b-e850-47d8-9145-ac9fa89df26d"",
""path"": ""<Gamepad>/dpad/left"",
""interactions"": """",
""processors"": """",
""groups"": "";Gamepad"",
""action"": ""DPadLeft"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""9e0e5892-9146-4620-871c-37bb50b8e484"",
""path"": ""<Keyboard>/leftArrow"",
""interactions"": """",
""processors"": """",
""groups"": "";Keyboard & Mouse"",
""action"": ""DPadLeft"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""9f12731a-bb57-4162-9fec-dca11a536042"",
""path"": ""<Gamepad>/dpad/right"",
""interactions"": """",
""processors"": """",
""groups"": "";Gamepad"",
""action"": ""DPadRight"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""399022c0-99fe-48e3-bc3c-d61de6e86b0c"",
""path"": ""<Keyboard>/rightArrow"",
""interactions"": """",
""processors"": """",
""groups"": "";Keyboard & Mouse"",
""action"": ""DPadRight"",
""isComposite"": false,
""isPartOfComposite"": false
} }
] ]
} }
@ -267,6 +360,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
// sentinel // sentinel
m_sentinel = asset.FindActionMap("sentinel", throwIfNotFound: true); m_sentinel = asset.FindActionMap("sentinel", throwIfNotFound: true);
m_sentinel_Movement = m_sentinel.FindAction("Movement", throwIfNotFound: true); m_sentinel_Movement = m_sentinel.FindAction("Movement", throwIfNotFound: true);
m_sentinel_Interact = m_sentinel.FindAction("Interact", throwIfNotFound: true);
m_sentinel_DPadLeft = m_sentinel.FindAction("DPadLeft", throwIfNotFound: true);
m_sentinel_DPadRight = m_sentinel.FindAction("DPadRight", throwIfNotFound: true);
m_sentinel_Dash = m_sentinel.FindAction("Dash", throwIfNotFound: true); m_sentinel_Dash = m_sentinel.FindAction("Dash", throwIfNotFound: true);
m_sentinel_Reset = m_sentinel.FindAction("Reset", throwIfNotFound: true); m_sentinel_Reset = m_sentinel.FindAction("Reset", throwIfNotFound: true);
} }
@ -350,6 +446,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
private readonly InputActionMap m_sentinel; private readonly InputActionMap m_sentinel;
private List<ISentinelActions> m_SentinelActionsCallbackInterfaces = new List<ISentinelActions>(); private List<ISentinelActions> m_SentinelActionsCallbackInterfaces = new List<ISentinelActions>();
private readonly InputAction m_sentinel_Movement; private readonly InputAction m_sentinel_Movement;
private readonly InputAction m_sentinel_Interact;
private readonly InputAction m_sentinel_DPadLeft;
private readonly InputAction m_sentinel_DPadRight;
private readonly InputAction m_sentinel_Dash; private readonly InputAction m_sentinel_Dash;
private readonly InputAction m_sentinel_Reset; private readonly InputAction m_sentinel_Reset;
/// <summary> /// <summary>
@ -368,6 +467,18 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
/// </summary> /// </summary>
public InputAction @Movement => m_Wrapper.m_sentinel_Movement; public InputAction @Movement => m_Wrapper.m_sentinel_Movement;
/// <summary> /// <summary>
/// Provides access to the underlying input action "sentinel/Interact".
/// </summary>
public InputAction @Interact => m_Wrapper.m_sentinel_Interact;
/// <summary>
/// Provides access to the underlying input action "sentinel/DPadLeft".
/// </summary>
public InputAction @DPadLeft => m_Wrapper.m_sentinel_DPadLeft;
/// <summary>
/// Provides access to the underlying input action "sentinel/DPadRight".
/// </summary>
public InputAction @DPadRight => m_Wrapper.m_sentinel_DPadRight;
/// <summary>
/// Provides access to the underlying input action "sentinel/Dash". /// Provides access to the underlying input action "sentinel/Dash".
/// </summary> /// </summary>
public InputAction @Dash => m_Wrapper.m_sentinel_Dash; public InputAction @Dash => m_Wrapper.m_sentinel_Dash;
@ -404,6 +515,15 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Movement.started += instance.OnMovement; @Movement.started += instance.OnMovement;
@Movement.performed += instance.OnMovement; @Movement.performed += instance.OnMovement;
@Movement.canceled += instance.OnMovement; @Movement.canceled += instance.OnMovement;
@Interact.started += instance.OnInteract;
@Interact.performed += instance.OnInteract;
@Interact.canceled += instance.OnInteract;
@DPadLeft.started += instance.OnDPadLeft;
@DPadLeft.performed += instance.OnDPadLeft;
@DPadLeft.canceled += instance.OnDPadLeft;
@DPadRight.started += instance.OnDPadRight;
@DPadRight.performed += instance.OnDPadRight;
@DPadRight.canceled += instance.OnDPadRight;
@Dash.started += instance.OnDash; @Dash.started += instance.OnDash;
@Dash.performed += instance.OnDash; @Dash.performed += instance.OnDash;
@Dash.canceled += instance.OnDash; @Dash.canceled += instance.OnDash;
@ -424,6 +544,15 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Movement.started -= instance.OnMovement; @Movement.started -= instance.OnMovement;
@Movement.performed -= instance.OnMovement; @Movement.performed -= instance.OnMovement;
@Movement.canceled -= instance.OnMovement; @Movement.canceled -= instance.OnMovement;
@Interact.started -= instance.OnInteract;
@Interact.performed -= instance.OnInteract;
@Interact.canceled -= instance.OnInteract;
@DPadLeft.started -= instance.OnDPadLeft;
@DPadLeft.performed -= instance.OnDPadLeft;
@DPadLeft.canceled -= instance.OnDPadLeft;
@DPadRight.started -= instance.OnDPadRight;
@DPadRight.performed -= instance.OnDPadRight;
@DPadRight.canceled -= instance.OnDPadRight;
@Dash.started -= instance.OnDash; @Dash.started -= instance.OnDash;
@Dash.performed -= instance.OnDash; @Dash.performed -= instance.OnDash;
@Dash.canceled -= instance.OnDash; @Dash.canceled -= instance.OnDash;
@ -504,6 +633,27 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" /> /// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnMovement(InputAction.CallbackContext context); void OnMovement(InputAction.CallbackContext context);
/// <summary> /// <summary>
/// Method invoked when associated input action "Interact" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnInteract(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "DPadLeft" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnDPadLeft(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "DPadRight" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
void OnDPadRight(InputAction.CallbackContext context);
/// <summary>
/// Method invoked when associated input action "Dash" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />. /// Method invoked when associated input action "Dash" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
/// </summary> /// </summary>
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" /> /// <seealso cref="UnityEngine.InputSystem.InputAction.started" />

View File

@ -15,6 +15,33 @@
"interactions": "", "interactions": "",
"initialStateCheck": true "initialStateCheck": true
}, },
{
"name": "Interact",
"type": "Button",
"id": "f0264441-a456-4101-8595-7a760a1a76c7",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "DPadLeft",
"type": "Button",
"id": "59874fde-0b05-4c43-ab94-2f610c20fa7c",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "DPadRight",
"type": "Button",
"id": "28db83e0-7ec7-4068-a414-99928dd3ab95",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{ {
"name": "Dash", "name": "Dash",
"type": "Button", "type": "Button",
@ -144,6 +171,72 @@
"action": "Reset", "action": "Reset",
"isComposite": false, "isComposite": false,
"isPartOfComposite": false "isPartOfComposite": false
},
{
"name": "",
"id": "ce95f2f6-e4dd-43af-99e1-156acd6f7fba",
"path": "<Gamepad>/buttonNorth",
"interactions": "",
"processors": "",
"groups": ";Gamepad",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "c255d0d2-61f6-42f8-ba50-a352926f0ac7",
"path": "<Keyboard>/e",
"interactions": "",
"processors": "",
"groups": ";Keyboard & Mouse",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6de8721b-e850-47d8-9145-ac9fa89df26d",
"path": "<Gamepad>/dpad/left",
"interactions": "",
"processors": "",
"groups": ";Gamepad",
"action": "DPadLeft",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "9e0e5892-9146-4620-871c-37bb50b8e484",
"path": "<Keyboard>/leftArrow",
"interactions": "",
"processors": "",
"groups": ";Keyboard & Mouse",
"action": "DPadLeft",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "9f12731a-bb57-4162-9fec-dca11a536042",
"path": "<Gamepad>/dpad/right",
"interactions": "",
"processors": "",
"groups": ";Gamepad",
"action": "DPadRight",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "399022c0-99fe-48e3-bc3c-d61de6e86b0c",
"path": "<Keyboard>/rightArrow",
"interactions": "",
"processors": "",
"groups": ";Keyboard & Mouse",
"action": "DPadRight",
"isComposite": false,
"isPartOfComposite": false
} }
] ]
} }

View File

@ -61,6 +61,9 @@ namespace Intrepid.Integration.Input
Movement = () => Locking.IsNotLocked Movement = () => Locking.IsNotLocked
? InputActions.sentinel.Movement.ReadValue<Vector2>() ? InputActions.sentinel.Movement.ReadValue<Vector2>()
: Vector2.zero, : Vector2.zero,
Interact = () => Locking.IsNotLocked && InputActions.sentinel.Interact.WasPressedThisFrame(),
DPadLeft = () => Locking.IsNotLocked && InputActions.sentinel.DPadLeft.WasPressedThisFrame(),
DPadRight = () => Locking.IsNotLocked && InputActions.sentinel.DPadRight.WasPressedThisFrame(),
Dash = () => Locking.IsNotLocked && InputActions.sentinel.Dash.WasPressedThisFrame(), Dash = () => Locking.IsNotLocked && InputActions.sentinel.Dash.WasPressedThisFrame(),
// debug // debug