diff --git a/Assets/Prefabs/GameCanvas.prefab b/Assets/Prefabs/GameCanvas.prefab index a52fe15..2242999 100644 --- a/Assets/Prefabs/GameCanvas.prefab +++ b/Assets/Prefabs/GameCanvas.prefab @@ -348,7 +348,7 @@ MonoBehaviour: m_LineType: 0 m_HideMobileInput: 0 m_CharacterValidation: 0 - m_CharacterLimit: 0 + m_CharacterLimit: 30 m_OnSubmit: m_PersistentCalls: m_Calls: [] @@ -1630,7 +1630,7 @@ Transform: m_GameObject: {fileID: 4750801393251488290} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 10, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1650,6 +1650,8 @@ MonoBehaviour: m_EditorClassIdentifier: HurtOverlay: {fileID: 6456657860247816393} SliderThing: {fileID: 6656112534571270696} + Spawner: {fileID: 1850279079604088768} + k__BackingField: 0 --- !u!136 &2494850548308267933 CapsuleCollider: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/PlayerReplayer.prefab b/Assets/Prefabs/PlayerReplayer.prefab index 13a0bef..f9b89fd 100644 --- a/Assets/Prefabs/PlayerReplayer.prefab +++ b/Assets/Prefabs/PlayerReplayer.prefab @@ -72,6 +72,7 @@ GameObject: m_Component: - component: {fileID: 1807660236798938897} - component: {fileID: 1013965729963872153} + - component: {fileID: 1783748808844086845} - component: {fileID: 7220179918976106526} - component: {fileID: 7410036744236083586} - component: {fileID: 9011244016352067911} @@ -79,7 +80,6 @@ GameObject: - component: {fileID: 5849392838882679854} - component: {fileID: 582799264655932961} - component: {fileID: 3380663186425371797} - - component: {fileID: 1783748808844086845} m_Layer: 0 m_Name: PlayerReplayer m_TagString: Untagged @@ -134,6 +134,19 @@ MonoBehaviour: - {fileID: 8300000, guid: 413764415f5bf42429d26861fc5e82cf, type: 3} - {fileID: 8300000, guid: 21713b7ac8710bf4fb3b949bbbebb67a, type: 3} PlayerAudioSource: {fileID: 3380663186425371797} +--- !u!114 &1783748808844086845 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5082956827802089079} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ab982c94ab064b944947c4792e623299, type: 3} + m_Name: + m_EditorClassIdentifier: + cam: {fileID: 7220179918976106526} --- !u!20 &7220179918976106526 Camera: m_ObjectHideFlags: 0 @@ -404,19 +417,6 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 ---- !u!114 &1783748808844086845 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5082956827802089079} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ab982c94ab064b944947c4792e623299, type: 3} - m_Name: - m_EditorClassIdentifier: - cam: {fileID: 7220179918976106526} --- !u!1 &6013909295272487250 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/LifeThingTrackerThing.cs b/Assets/Scripts/LifeThingTrackerThing.cs index 389fa99..e179cbe 100644 --- a/Assets/Scripts/LifeThingTrackerThing.cs +++ b/Assets/Scripts/LifeThingTrackerThing.cs @@ -9,34 +9,45 @@ namespace InterfaceOff.WorldScene { [SerializeField] private GameObject HurtOverlay; [SerializeField] private Slider SliderThing; + [SerializeField] private WindowSpawner Spawner; + + [field: SerializeField] public int HitsTaken { get; private set; } private Rigidbody body; private void Awake() { body = GetComponent(); + + Vector3 pos = transform.localPosition; + pos.y = Mathf.Infinity; + transform.localPosition = pos; } void LateUpdate() { - Vector3 pos = transform.localPosition; - pos.y = Mathf.Clamp(pos.y, 0, 10); - - if (Mathf.Approximately(pos.y, 0.0f)) + if (Spawner.AutoSpawn) { - StartCoroutine(routine: DisplayHurtOverlay()); - - body.velocity = Vector3.zero; - pos.y = 10.0f; - } + Vector3 pos = transform.localPosition; + pos.y = Mathf.Clamp(pos.y, 0, 10); - if (Mathf.Approximately(pos.y, 10.0f)) - { - body.velocity = Vector3.zero; - } + if (Mathf.Approximately(pos.y, 0.0f)) + { + StartCoroutine(routine: DisplayHurtOverlay()); + HitsTaken++; - transform.localPosition = pos; - SliderThing.value = pos.y; + body.velocity = Vector3.zero; + pos.y = 10.0f; + } + + if (Mathf.Approximately(pos.y, 10.0f)) + { + body.velocity = Vector3.zero; + } + + transform.localPosition = pos; + SliderThing.value = pos.y; + } } [UsedImplicitly] public void AddForceUp() diff --git a/Assets/Scripts/WindowSpawner.cs b/Assets/Scripts/WindowSpawner.cs index 067f0c5..671818f 100644 --- a/Assets/Scripts/WindowSpawner.cs +++ b/Assets/Scripts/WindowSpawner.cs @@ -130,12 +130,12 @@ namespace InterfaceOff PasswordField.SetActive(false); /* Else checks if it should change the active scene */ - if (Input.GetKey(KeyCode.Space) && LeaderboardObject.activeSelf) + if (Input.GetKey(KeyCode.Space) && !LeaderboardObject.activeSelf) { SceneController.ReloadScene(); } - else if (Input.GetKey(KeyCode.Tab) && LeaderboardObject.activeSelf) + else if (Input.GetKey(KeyCode.Tab) && !LeaderboardObject.activeSelf) { SceneController.Load(name: "MenuScene"); }