From 8472073b5676eabe1c0de56c22a84184479a4d8f Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 3 Oct 2023 16:37:17 +1100 Subject: [PATCH] textures and pause game --- Assets/Scenes/msg_blackstar.unity | 0 Assets/Scenes/sr_junglism2/TunnelMatBlue.mat | 2 +- Assets/Scenes/sr_junglism2/TunnelMatGreen.mat | 2 +- Assets/Scenes/sr_junglism2/TunnelMatRed.mat | 2 +- Assets/Scenes/sr_sfz.unity | 6 +++++- Assets/Scenes/sr_sfz/sfz_walls2.mat | 16 ++++++++-------- Assets/Src/ShipControls.cs | 12 ++++++------ Assets/Src/Timing.cs | 4 ++-- Assets/Src/UI/MenuControls.cs | 19 +++++++++++++++++-- Assets/Src/UI/TimingUI.cs | 1 + ProjectSettings/TimeManager.asset | 2 +- 11 files changed, 43 insertions(+), 23 deletions(-) mode change 100755 => 100644 Assets/Scenes/msg_blackstar.unity mode change 100755 => 100644 Assets/Scenes/sr_junglism2/TunnelMatGreen.mat mode change 100755 => 100644 Assets/Scenes/sr_sfz/sfz_walls2.mat mode change 100755 => 100644 ProjectSettings/TimeManager.asset diff --git a/Assets/Scenes/msg_blackstar.unity b/Assets/Scenes/msg_blackstar.unity old mode 100755 new mode 100644 diff --git a/Assets/Scenes/sr_junglism2/TunnelMatBlue.mat b/Assets/Scenes/sr_junglism2/TunnelMatBlue.mat index 38d818f..818f3fe 100644 --- a/Assets/Scenes/sr_junglism2/TunnelMatBlue.mat +++ b/Assets/Scenes/sr_junglism2/TunnelMatBlue.mat @@ -128,7 +128,7 @@ Material: m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 0, g: 2.2588236, b: 8, a: 1} + - _EmissionColor: {r: 0, g: 0.42297584, b: 1.4980394, a: 1} - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} m_BuildTextureStacks: [] --- !u!114 &398519245074296181 diff --git a/Assets/Scenes/sr_junglism2/TunnelMatGreen.mat b/Assets/Scenes/sr_junglism2/TunnelMatGreen.mat old mode 100755 new mode 100644 index b4fccff..e657e81 --- a/Assets/Scenes/sr_junglism2/TunnelMatGreen.mat +++ b/Assets/Scenes/sr_junglism2/TunnelMatGreen.mat @@ -128,7 +128,7 @@ Material: m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 0, g: 4, b: 0.14117648, a: 1} + - _EmissionColor: {r: 0, g: 1.4980394, b: 0.05287198, a: 1} - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} m_BuildTextureStacks: [] --- !u!114 &398519245074296181 diff --git a/Assets/Scenes/sr_junglism2/TunnelMatRed.mat b/Assets/Scenes/sr_junglism2/TunnelMatRed.mat index aad7043..e6987a0 100644 --- a/Assets/Scenes/sr_junglism2/TunnelMatRed.mat +++ b/Assets/Scenes/sr_junglism2/TunnelMatRed.mat @@ -128,7 +128,7 @@ Material: m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 8, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 1.4980394, g: 0, b: 0, a: 1} - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} m_BuildTextureStacks: [] --- !u!114 &398519245074296181 diff --git a/Assets/Scenes/sr_sfz.unity b/Assets/Scenes/sr_sfz.unity index 3efed4c..fb0f2cd 100644 --- a/Assets/Scenes/sr_sfz.unity +++ b/Assets/Scenes/sr_sfz.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0.14633277, g: 0.17844424, b: 0.14237845, a: 1} + m_IndirectSpecularColor: {r: 0.13586485, g: 0.16515756, b: 0.1291475, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -1382,6 +1382,10 @@ PrefabInstance: propertyPath: timingUi value: objectReference: {fileID: 766862836} + - target: {fileID: 5313449993149091347, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3} + propertyPath: shipAudio + value: + objectReference: {fileID: 235775467} - target: {fileID: 5313449993149091347, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3} propertyPath: timingDoc value: diff --git a/Assets/Scenes/sr_sfz/sfz_walls2.mat b/Assets/Scenes/sr_sfz/sfz_walls2.mat old mode 100755 new mode 100644 index 8c0dcc0..17f25b8 --- a/Assets/Scenes/sr_sfz/sfz_walls2.mat +++ b/Assets/Scenes/sr_sfz/sfz_walls2.mat @@ -30,11 +30,11 @@ Material: serializedVersion: 3 m_TexEnvs: - _BaseMap: - m_Texture: {fileID: 2800000, guid: 57878ff7becbdfeb49e897c235fcd13a, type: 3} + m_Texture: {fileID: 2800000, guid: 17801f6600aff15a9a030fe1477f76a6, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _BumpMap: - m_Texture: {fileID: 2800000, guid: 687d8e41dbf54edb68a65b1f399660c6, type: 3} + m_Texture: {fileID: 2800000, guid: 89bb05f0f47cc490798f25ad3e26f563, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _DetailAlbedoMap: @@ -42,7 +42,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _DetailMask: - m_Texture: {fileID: 2800000, guid: 277d00e38be7681a491dd3bf1557824a, type: 3} + m_Texture: {fileID: 2800000, guid: bc3995cb0bd4043df818b9e9540ae135, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _DetailNormalMap: @@ -50,23 +50,23 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _EmissionMap: - m_Texture: {fileID: 2800000, guid: 5903a9f196dc3dc4983ea3caa46c011e, type: 3} + m_Texture: {fileID: 2800000, guid: 9c8cb3484bdeeaed0bdf2414b7e7bc41, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: - m_Texture: {fileID: 2800000, guid: 57878ff7becbdfeb49e897c235fcd13a, type: 3} + m_Texture: {fileID: 2800000, guid: 17801f6600aff15a9a030fe1477f76a6, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MetallicGlossMap: - m_Texture: {fileID: 2800000, guid: 38b1ebcc987699268bff0eb4013b6b82, type: 3} + m_Texture: {fileID: 2800000, guid: 33165c4da57b0a30283e5dc7e509360f, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OcclusionMap: - m_Texture: {fileID: 2800000, guid: a426ec70e6f7f3a339bae47e767905b0, type: 3} + m_Texture: {fileID: 2800000, guid: cc2a9cfbc7336b2708a860f84e70cd49, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _ParallaxMap: - m_Texture: {fileID: 2800000, guid: 56c50cf21746aadf6a4f5f684a050b1e, type: 3} + m_Texture: {fileID: 2800000, guid: ba18cee4f860687e2bec971b0864e0ef, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _SpecGlossMap: diff --git a/Assets/Src/ShipControls.cs b/Assets/Src/ShipControls.cs index 0ae9869..69089e8 100755 --- a/Assets/Src/ShipControls.cs +++ b/Assets/Src/ShipControls.cs @@ -9,7 +9,7 @@ public class ShipControls : MonoBehaviour { public Camera aim; public Timing timing; - ShipAudio audio; + ShipAudio shipAudio; SpaceRaceInput input; Rigidbody rigidBody; @@ -64,7 +64,7 @@ public class ShipControls : MonoBehaviour { void Start() { Cursor.lockState = CursorLockMode.Locked; rigidBody = GetComponent(); - audio = GetComponentInChildren(); + shipAudio = GetComponentInChildren(); // just stop the body from being affected by rotation for now // until the 3p camera is in to explain why @@ -174,7 +174,7 @@ public class ShipControls : MonoBehaviour { } public void Respawn() { - audio.PlayNoise(); + shipAudio.PlayNoise(); // IMPORTANT // stop the timer before we move the ship or anything // otherwise it might generate a checkpoint time @@ -203,7 +203,7 @@ public class ShipControls : MonoBehaviour { public void Damage(float amt, string src) { Debug.Log($"Damage {amt} from {src}"); - audio.PlayNoise(); + shipAudio.PlayNoise(); // convert dmg to % to hide internals float dmg = (amt / powerUnit.ShieldMax) * 100f; @@ -223,7 +223,7 @@ public class ShipControls : MonoBehaviour { void Deploy(Output output) { bool deployed = powerUnit.Deploy(output); - if (deployed) audio.PlayNoise(); + if (deployed) shipAudio.PlayNoise(); } // I prefer doing it this way than registering the callbacks etc @@ -278,7 +278,7 @@ public class ShipControls : MonoBehaviour { void OnPowerUnit4(InputAction.CallbackContext ctx) => Deploy(Output.Shield); void OnBoostCharge() { - // audio.PlayNoise(); + // shipAudio.PlayNoise(); // do some ui fx whatever } diff --git a/Assets/Src/Timing.cs b/Assets/Src/Timing.cs index c3990dd..2fc260c 100644 --- a/Assets/Src/Timing.cs +++ b/Assets/Src/Timing.cs @@ -17,7 +17,7 @@ public class Timing: MonoBehaviour { public bool timerEnabled; [SerializeField] - ShipAudio audio; + ShipAudio shipAudio; public string mapName; public double sectorTime; @@ -111,7 +111,7 @@ public class Timing: MonoBehaviour { Debug.Log($"{sectorTimes.Count} / {sectors.Length}"); // play a sound :) - if (audio != null) audio.PlayNoise(); + if (shipAudio != null) shipAudio.PlayNoise(); // restart the timer for the next sector sectorStart = Time.timeAsDouble; diff --git a/Assets/Src/UI/MenuControls.cs b/Assets/Src/UI/MenuControls.cs index d2dc5aa..ad0152f 100644 --- a/Assets/Src/UI/MenuControls.cs +++ b/Assets/Src/UI/MenuControls.cs @@ -29,7 +29,7 @@ public class MenuControls : MonoBehaviour { ControlsUI controlsUI; [SerializeField] - ShipAudio audio; + ShipAudio shipAudio; SpaceRaceInput input; @@ -68,14 +68,26 @@ public class MenuControls : MonoBehaviour { input.menu.Enable(); input.menu.ToggleMenu.started += OnToggleMenu; input.menu.CloseMenu.started += OnCloseMenu; + + InputSystem.onDeviceChange += OnDeviceChange; + } + + void OnDeviceChange(InputDevice device, InputDeviceChange change) { + if (change != InputDeviceChange.Removed) return; + Show(); } void OnDestroy() { input.menu.ToggleMenu.started -= OnToggleMenu; input.menu.CloseMenu.started -= OnCloseMenu; + + InputSystem.onDeviceChange -= OnDeviceChange; } void Show() { + // pause the game + Time.timeScale = 0f; + visible = true; UnityEngine.Cursor.lockState = CursorLockMode.None; menuDoc.enabled = true; @@ -96,6 +108,9 @@ public class MenuControls : MonoBehaviour { } void Hide() { + // pause the game + Time.timeScale = 1f; + visible = false; UnityEngine.Cursor.lockState = CursorLockMode.Locked; menuDoc.enabled = false; @@ -111,7 +126,7 @@ public class MenuControls : MonoBehaviour { } void OnToggleMenu(InputAction.CallbackContext _ctx) { - audio.PlayNoise(); + shipAudio.PlayNoise(); visible = !visible; if (visible) { diff --git a/Assets/Src/UI/TimingUI.cs b/Assets/Src/UI/TimingUI.cs index b851b76..5094235 100644 --- a/Assets/Src/UI/TimingUI.cs +++ b/Assets/Src/UI/TimingUI.cs @@ -27,6 +27,7 @@ public class TimingUI : MonoBehaviour { Label noticePosition; bool ShouldHide => timing?.sectors.Count() == 0; + public bool TimerEnabled => timing.timerEnabled; static string[] completionMsgs = { "(⌐▨_▨)", diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset old mode 100755 new mode 100644 index 58b5dc2..2b68bdc --- a/ProjectSettings/TimeManager.asset +++ b/ProjectSettings/TimeManager.asset @@ -5,5 +5,5 @@ TimeManager: m_ObjectHideFlags: 0 Fixed Timestep: 0.01 Maximum Allowed Timestep: 0.33333334 - m_TimeScale: 1 + m_TimeScale: 0 Maximum Particle Timestep: 0.03