From 716da3b1464030f257ec8d4869887976a4dc5568 Mon Sep 17 00:00:00 2001 From: ntr Date: Wed, 9 Aug 2023 21:17:54 +1000 Subject: [PATCH] fix ss walls --- Assets/Resources/SpaceRaceInput.inputactions | 80 ++++++++++++ .../sr_silverstorage/silverstorage.blend | 4 +- .../sr_silverstorage/silverstorage.blend1 | 4 +- Assets/Src/PowerUnit.cs | 3 +- Assets/Src/ShipControls.cs | 5 + Assets/Src/ShipInput.cs | 120 ++++++++++++++++++ Assets/Src/UI/TimingUI.cs | 2 +- 7 files changed, 211 insertions(+), 7 deletions(-) diff --git a/Assets/Resources/SpaceRaceInput.inputactions b/Assets/Resources/SpaceRaceInput.inputactions index 30adbf9..bf7896a 100755 --- a/Assets/Resources/SpaceRaceInput.inputactions +++ b/Assets/Resources/SpaceRaceInput.inputactions @@ -58,6 +58,42 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "powerUnit1", + "type": "Button", + "id": "7871c83b-4bda-4ee4-8128-ed5cd975ff95", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "powerUnit2", + "type": "Button", + "id": "e82aecf6-6941-44ee-b67e-fc4e55837abe", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "powerUnit3", + "type": "Button", + "id": "09c2221d-dc0e-46d0-9bdf-8e66b25b0e83", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "powerUnit4", + "type": "Button", + "id": "49bf2fe6-f03b-4dec-9dd9-e571a9ae3e90", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false } ], "bindings": [ @@ -313,6 +349,50 @@ "action": "look", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "448824b6-c8b3-47ec-b7f7-0123f90cf5f6", + "path": "/1", + "interactions": "", + "processors": "", + "groups": "", + "action": "powerUnit1", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "18e2e44e-8735-45ce-aad2-b75c212fc4dc", + "path": "/2", + "interactions": "", + "processors": "", + "groups": "", + "action": "powerUnit2", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "46351ee7-55d7-428d-9778-6ffd51bc663c", + "path": "/3", + "interactions": "", + "processors": "", + "groups": "", + "action": "powerUnit3", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "e36dc262-5e19-467b-9153-98f8795b3752", + "path": "/4", + "interactions": "", + "processors": "", + "groups": "", + "action": "powerUnit4", + "isComposite": false, + "isPartOfComposite": false } ] }, diff --git a/Assets/Scenes/sr_silverstorage/silverstorage.blend b/Assets/Scenes/sr_silverstorage/silverstorage.blend index a545d2a..7bc57eb 100644 --- a/Assets/Scenes/sr_silverstorage/silverstorage.blend +++ b/Assets/Scenes/sr_silverstorage/silverstorage.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:06bc9e43e6400885e51dda7c135e88410a88d280ae00f031c946b0a84b65531f -size 22191904 +oid sha256:f1448a3496608ac466fc4ac4acc539088b6c8ba3b40000a860d25183afd73ec6 +size 22143988 diff --git a/Assets/Scenes/sr_silverstorage/silverstorage.blend1 b/Assets/Scenes/sr_silverstorage/silverstorage.blend1 index 7e1f99e..a95d2a4 100644 --- a/Assets/Scenes/sr_silverstorage/silverstorage.blend1 +++ b/Assets/Scenes/sr_silverstorage/silverstorage.blend1 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2b0373c653afcb1f8aa7344451832177d1f7b4d63a4c995f8355041b3bb9b122 -size 22191584 +oid sha256:a92c7cd61ed40ede9a2f2393627bac9b61b9cf66b24bf3e46dd666b0d2f91690 +size 22139596 diff --git a/Assets/Src/PowerUnit.cs b/Assets/Src/PowerUnit.cs index 6d3e4e7..6b89d23 100644 --- a/Assets/Src/PowerUnit.cs +++ b/Assets/Src/PowerUnit.cs @@ -27,11 +27,10 @@ public class PowerUnit { shieldsRegen = (shieldsMax / 5f) * Time.fixedDeltaTime; } - public void Reassign(float accel, float decel, float strafe, float shields) { + public void Reassign(float accel, float decel, float strafe) { acceleration = baseOutput * accel; deceleration = baseOutput * decel; strafing = baseOutput * strafe; - shieldsRegen = shields; } // returns whether shields depleted diff --git a/Assets/Src/ShipControls.cs b/Assets/Src/ShipControls.cs index d3e351a..d7d5c0f 100755 --- a/Assets/Src/ShipControls.cs +++ b/Assets/Src/ShipControls.cs @@ -217,4 +217,9 @@ public class ShipControls : MonoBehaviour, SpaceRaceInput.IShipActions { public void OnAccelerate(InputAction.CallbackContext ctx) { } public void OnDecelerate(InputAction.CallbackContext ctx) { } public void OnLook(InputAction.CallbackContext ctx) { } + + public void OnPowerUnit1 (InputAction.CallbackContext ctx) => powerUnit.Reassign(2f, 4f, 1f); + public void OnPowerUnit2 (InputAction.CallbackContext ctx) => powerUnit.Reassign(2f, 4f, 3f); + public void OnPowerUnit4 (InputAction.CallbackContext ctx) => powerUnit.Reassign(2f, 5f, 0f); + public void OnPowerUnit3 (InputAction.CallbackContext ctx) => powerUnit.Reassign(1f, 3f, 3f); } \ No newline at end of file diff --git a/Assets/Src/ShipInput.cs b/Assets/Src/ShipInput.cs index 20a9cb2..ef13851 100755 --- a/Assets/Src/ShipInput.cs +++ b/Assets/Src/ShipInput.cs @@ -80,6 +80,42 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable ""processors"": """", ""interactions"": """", ""initialStateCheck"": false + }, + { + ""name"": ""powerUnit1"", + ""type"": ""Button"", + ""id"": ""7871c83b-4bda-4ee4-8128-ed5cd975ff95"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""powerUnit2"", + ""type"": ""Button"", + ""id"": ""e82aecf6-6941-44ee-b67e-fc4e55837abe"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""powerUnit3"", + ""type"": ""Button"", + ""id"": ""09c2221d-dc0e-46d0-9bdf-8e66b25b0e83"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + }, + { + ""name"": ""powerUnit4"", + ""type"": ""Button"", + ""id"": ""49bf2fe6-f03b-4dec-9dd9-e571a9ae3e90"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false } ], ""bindings"": [ @@ -335,6 +371,50 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable ""action"": ""look"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""448824b6-c8b3-47ec-b7f7-0123f90cf5f6"", + ""path"": ""/1"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""powerUnit1"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""18e2e44e-8735-45ce-aad2-b75c212fc4dc"", + ""path"": ""/2"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""powerUnit2"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""46351ee7-55d7-428d-9778-6ffd51bc663c"", + ""path"": ""/3"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""powerUnit3"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""e36dc262-5e19-467b-9153-98f8795b3752"", + ""path"": ""/4"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""powerUnit4"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] }, @@ -388,6 +468,10 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable m_ship_look = m_ship.FindAction("look", throwIfNotFound: true); m_ship_respawn = m_ship.FindAction("respawn", throwIfNotFound: true); m_ship_quit = m_ship.FindAction("quit", throwIfNotFound: true); + m_ship_powerUnit1 = m_ship.FindAction("powerUnit1", throwIfNotFound: true); + m_ship_powerUnit2 = m_ship.FindAction("powerUnit2", throwIfNotFound: true); + m_ship_powerUnit3 = m_ship.FindAction("powerUnit3", throwIfNotFound: true); + m_ship_powerUnit4 = m_ship.FindAction("powerUnit4", throwIfNotFound: true); // menu m_menu = asset.FindActionMap("menu", throwIfNotFound: true); m_menu_ToggleMenu = m_menu.FindAction("ToggleMenu", throwIfNotFound: true); @@ -458,6 +542,10 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable private readonly InputAction m_ship_look; private readonly InputAction m_ship_respawn; private readonly InputAction m_ship_quit; + private readonly InputAction m_ship_powerUnit1; + private readonly InputAction m_ship_powerUnit2; + private readonly InputAction m_ship_powerUnit3; + private readonly InputAction m_ship_powerUnit4; public struct ShipActions { private @SpaceRaceInput m_Wrapper; @@ -468,6 +556,10 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable public InputAction @look => m_Wrapper.m_ship_look; public InputAction @respawn => m_Wrapper.m_ship_respawn; public InputAction @quit => m_Wrapper.m_ship_quit; + public InputAction @powerUnit1 => m_Wrapper.m_ship_powerUnit1; + public InputAction @powerUnit2 => m_Wrapper.m_ship_powerUnit2; + public InputAction @powerUnit3 => m_Wrapper.m_ship_powerUnit3; + public InputAction @powerUnit4 => m_Wrapper.m_ship_powerUnit4; public InputActionMap Get() { return m_Wrapper.m_ship; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -495,6 +587,18 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable @quit.started += instance.OnQuit; @quit.performed += instance.OnQuit; @quit.canceled += instance.OnQuit; + @powerUnit1.started += instance.OnPowerUnit1; + @powerUnit1.performed += instance.OnPowerUnit1; + @powerUnit1.canceled += instance.OnPowerUnit1; + @powerUnit2.started += instance.OnPowerUnit2; + @powerUnit2.performed += instance.OnPowerUnit2; + @powerUnit2.canceled += instance.OnPowerUnit2; + @powerUnit3.started += instance.OnPowerUnit3; + @powerUnit3.performed += instance.OnPowerUnit3; + @powerUnit3.canceled += instance.OnPowerUnit3; + @powerUnit4.started += instance.OnPowerUnit4; + @powerUnit4.performed += instance.OnPowerUnit4; + @powerUnit4.canceled += instance.OnPowerUnit4; } private void UnregisterCallbacks(IShipActions instance) @@ -517,6 +621,18 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable @quit.started -= instance.OnQuit; @quit.performed -= instance.OnQuit; @quit.canceled -= instance.OnQuit; + @powerUnit1.started -= instance.OnPowerUnit1; + @powerUnit1.performed -= instance.OnPowerUnit1; + @powerUnit1.canceled -= instance.OnPowerUnit1; + @powerUnit2.started -= instance.OnPowerUnit2; + @powerUnit2.performed -= instance.OnPowerUnit2; + @powerUnit2.canceled -= instance.OnPowerUnit2; + @powerUnit3.started -= instance.OnPowerUnit3; + @powerUnit3.performed -= instance.OnPowerUnit3; + @powerUnit3.canceled -= instance.OnPowerUnit3; + @powerUnit4.started -= instance.OnPowerUnit4; + @powerUnit4.performed -= instance.OnPowerUnit4; + @powerUnit4.canceled -= instance.OnPowerUnit4; } public void RemoveCallbacks(IShipActions instance) @@ -588,6 +704,10 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable void OnLook(InputAction.CallbackContext context); void OnRespawn(InputAction.CallbackContext context); void OnQuit(InputAction.CallbackContext context); + void OnPowerUnit1(InputAction.CallbackContext context); + void OnPowerUnit2(InputAction.CallbackContext context); + void OnPowerUnit3(InputAction.CallbackContext context); + void OnPowerUnit4(InputAction.CallbackContext context); } public interface IMenuActions { diff --git a/Assets/Src/UI/TimingUI.cs b/Assets/Src/UI/TimingUI.cs index f5be9b9..e9cbc63 100644 --- a/Assets/Src/UI/TimingUI.cs +++ b/Assets/Src/UI/TimingUI.cs @@ -54,7 +54,7 @@ public class TimingUI : MonoBehaviour { return; } - timerTime.text = $"{TimeSpan.FromSeconds(timing.lapTime):m\\:ss\\.fff}"; + timerTime.text = $"{TimeSpan.FromSeconds(timing.lapTime):m\\:ss\\.f}"; // clearly this is not ideal but idk atm UpdateUI();