Add pause menu and fix static data dulpication when loading scenes

This commit is contained in:
BuyMyMojo 2023-03-04 03:57:30 +11:00
parent 0849fcfde7
commit e4706c7a42
11 changed files with 992 additions and 2 deletions

View file

@ -53,6 +53,15 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Pause"",
""type"": ""Button"",
""id"": ""d9b22910-f1ca-4aac-8dd2-4e8bd2fed7fe"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@ -220,6 +229,28 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
""action"": ""InteractAlternate"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""5ad26ffd-8906-4a7b-b3ea-0c60670706ee"",
""path"": ""<Keyboard>/escape"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Pause"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""9da1a7a9-629a-4f0b-8fd4-1f835ecd46e6"",
""path"": ""<Gamepad>/start"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Pause"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@ -231,6 +262,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true);
m_Player_Interact = m_Player.FindAction("Interact", throwIfNotFound: true);
m_Player_InteractAlternate = m_Player.FindAction("InteractAlternate", throwIfNotFound: true);
m_Player_Pause = m_Player.FindAction("Pause", throwIfNotFound: true);
}
public void Dispose()
@ -295,6 +327,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
private readonly InputAction m_Player_Move;
private readonly InputAction m_Player_Interact;
private readonly InputAction m_Player_InteractAlternate;
private readonly InputAction m_Player_Pause;
public struct PlayerActions
{
private @PlayerInputActions m_Wrapper;
@ -302,6 +335,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
public InputAction @Move => m_Wrapper.m_Player_Move;
public InputAction @Interact => m_Wrapper.m_Player_Interact;
public InputAction @InteractAlternate => m_Wrapper.m_Player_InteractAlternate;
public InputAction @Pause => m_Wrapper.m_Player_Pause;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@ -320,6 +354,9 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
@InteractAlternate.started += instance.OnInteractAlternate;
@InteractAlternate.performed += instance.OnInteractAlternate;
@InteractAlternate.canceled += instance.OnInteractAlternate;
@Pause.started += instance.OnPause;
@Pause.performed += instance.OnPause;
@Pause.canceled += instance.OnPause;
}
private void UnregisterCallbacks(IPlayerActions instance)
@ -333,6 +370,9 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
@InteractAlternate.started -= instance.OnInteractAlternate;
@InteractAlternate.performed -= instance.OnInteractAlternate;
@InteractAlternate.canceled -= instance.OnInteractAlternate;
@Pause.started -= instance.OnPause;
@Pause.performed -= instance.OnPause;
@Pause.canceled -= instance.OnPause;
}
public void RemoveCallbacks(IPlayerActions instance)
@ -355,5 +395,6 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
void OnMove(InputAction.CallbackContext context);
void OnInteract(InputAction.CallbackContext context);
void OnInteractAlternate(InputAction.CallbackContext context);
void OnPause(InputAction.CallbackContext context);
}
}