Skip to content

Commit

Permalink
Skip Cutscene Feature
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanBenz committed Dec 9, 2024
1 parent 8427ff4 commit e149f30
Show file tree
Hide file tree
Showing 13 changed files with 705 additions and 125 deletions.
17 changes: 14 additions & 3 deletions Sample2DProject/Assets/Input.inputactions
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@
"id": "38ed328d-dacf-4ef0-acdc-33379a49d669",
"actions": [
{
"name": "New action",
"name": "SkipCutscene",
"type": "Button",
"id": "86edda7f-df7a-40da-a8c8-b79f1b510350",
"expectedControlType": "Button",
Expand All @@ -887,11 +887,22 @@
{
"name": "",
"id": "269896ad-86f7-470e-94db-bd7818101dff",
"path": "",
"path": "<Keyboard>/enter",
"interactions": "",
"processors": "",
"groups": "",
"action": "SkipCutscene",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "08860cca-2484-45c5-9241-84f649163059",
"path": "<Gamepad>/start",
"interactions": "",
"processors": "",
"groups": "",
"action": "New action",
"action": "SkipCutscene",
"isComposite": false,
"isPartOfComposite": false
}
Expand Down
37 changes: 24 additions & 13 deletions Sample2DProject/Assets/PlayerInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ public @Input()
""id"": ""38ed328d-dacf-4ef0-acdc-33379a49d669"",
""actions"": [
{
""name"": ""New action"",
""name"": ""SkipCutscene"",
""type"": ""Button"",
""id"": ""86edda7f-df7a-40da-a8c8-b79f1b510350"",
""expectedControlType"": ""Button"",
Expand All @@ -909,11 +909,22 @@ public @Input()
{
""name"": """",
""id"": ""269896ad-86f7-470e-94db-bd7818101dff"",
""path"": """",
""path"": ""<Keyboard>/enter"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""SkipCutscene"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""08860cca-2484-45c5-9241-84f649163059"",
""path"": ""<Gamepad>/start"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""New action"",
""action"": ""SkipCutscene"",
""isComposite"": false,
""isPartOfComposite"": false
}
Expand Down Expand Up @@ -1009,7 +1020,7 @@ public @Input()
m_Hacking_Advance = m_Hacking.FindAction("Advance", throwIfNotFound: true);
// DisableInput
m_DisableInput = asset.FindActionMap("DisableInput", throwIfNotFound: true);
m_DisableInput_Newaction = m_DisableInput.FindAction("New action", throwIfNotFound: true);
m_DisableInput_SkipCutscene = m_DisableInput.FindAction("SkipCutscene", throwIfNotFound: true);
}

public void Dispose()
Expand Down Expand Up @@ -1329,12 +1340,12 @@ public void SetCallbacks(IHackingActions instance)
// DisableInput
private readonly InputActionMap m_DisableInput;
private List<IDisableInputActions> m_DisableInputActionsCallbackInterfaces = new List<IDisableInputActions>();
private readonly InputAction m_DisableInput_Newaction;
private readonly InputAction m_DisableInput_SkipCutscene;
public struct DisableInputActions
{
private @Input m_Wrapper;
public DisableInputActions(@Input wrapper) { m_Wrapper = wrapper; }
public InputAction @Newaction => m_Wrapper.m_DisableInput_Newaction;
public InputAction @SkipCutscene => m_Wrapper.m_DisableInput_SkipCutscene;
public InputActionMap Get() { return m_Wrapper.m_DisableInput; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
Expand All @@ -1344,16 +1355,16 @@ public void AddCallbacks(IDisableInputActions instance)
{
if (instance == null || m_Wrapper.m_DisableInputActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_DisableInputActionsCallbackInterfaces.Add(instance);
@Newaction.started += instance.OnNewaction;
@Newaction.performed += instance.OnNewaction;
@Newaction.canceled += instance.OnNewaction;
@SkipCutscene.started += instance.OnSkipCutscene;
@SkipCutscene.performed += instance.OnSkipCutscene;
@SkipCutscene.canceled += instance.OnSkipCutscene;
}

private void UnregisterCallbacks(IDisableInputActions instance)
{
@Newaction.started -= instance.OnNewaction;
@Newaction.performed -= instance.OnNewaction;
@Newaction.canceled -= instance.OnNewaction;
@SkipCutscene.started -= instance.OnSkipCutscene;
@SkipCutscene.performed -= instance.OnSkipCutscene;
@SkipCutscene.canceled -= instance.OnSkipCutscene;
}

public void RemoveCallbacks(IDisableInputActions instance)
Expand Down Expand Up @@ -1445,6 +1456,6 @@ public interface IHackingActions
}
public interface IDisableInputActions
{
void OnNewaction(InputAction.CallbackContext context);
void OnSkipCutscene(InputAction.CallbackContext context);
}
}
14 changes: 13 additions & 1 deletion Sample2DProject/Assets/Resources/SelectablePlayer1.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -2317,7 +2317,19 @@ MonoBehaviour:
m_ActionId: 0d0dc6e5-c8da-4ba2-83dd-d536cdb336ac
m_ActionName: Hacking/Advance[/Keyboard/space,/XInputControllerWindows/buttonSouth]
- m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 8825770351404935619}
m_TargetAssemblyTypeName: PlayerMovement, Assembly-CSharp
m_MethodName: OnSkipCutscene
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: 86edda7f-df7a-40da-a8c8-b79f1b510350
m_ActionName: DisableInput/New action
m_NeverAutoSwitchControlSchemes: 1
Expand Down
14 changes: 13 additions & 1 deletion Sample2DProject/Assets/Resources/SelectablePlayer2.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,19 @@ MonoBehaviour:
m_ActionId: 0d0dc6e5-c8da-4ba2-83dd-d536cdb336ac
m_ActionName: Hacking/Advance[/Keyboard/space,/XInputControllerWindows/buttonSouth]
- m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 3627847233429041494}
m_TargetAssemblyTypeName: PlayerMovement, Assembly-CSharp
m_MethodName: OnSkipCutscene
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: 86edda7f-df7a-40da-a8c8-b79f1b510350
m_ActionName: DisableInput/New action
m_NeverAutoSwitchControlSchemes: 1
Expand Down
Loading

0 comments on commit e149f30

Please sign in to comment.