From f4db94530961f6238078477d060ec14a9a5cbdfc Mon Sep 17 00:00:00 2001 From: SpoodyTheOne Date: Sun, 4 Feb 2024 10:31:50 +0100 Subject: [PATCH] nig --- Assets/Scenes/GamOvSnence.unity | 28 ++++++++++++++++++- ...sedTheMainMenuButtonOnTheGameOverScreen.cs | 12 ++------ Assets/Scripts/Managers/GameManager.cs | 28 +++++++++++++++++-- Assets/Scripts/Player/PlayerMovement.cs | 2 +- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/Assets/Scenes/GamOvSnence.unity b/Assets/Scenes/GamOvSnence.unity index e62304d..2300fbc 100644 --- a/Assets/Scenes/GamOvSnence.unity +++ b/Assets/Scenes/GamOvSnence.unity @@ -372,6 +372,7 @@ GameObject: - component: {fileID: 1111096819} - component: {fileID: 1111096818} - component: {fileID: 1111096817} + - component: {fileID: 1111096820} m_Layer: 5 m_Name: Returnbtn m_TagString: Untagged @@ -442,7 +443,20 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1111096818} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 1111096820} + m_TargetAssemblyTypeName: GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen, + Assembly-CSharp + m_MethodName: r + m_Mode: 1 + 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 --- !u!114 &1111096818 MonoBehaviour: m_ObjectHideFlags: 0 @@ -481,6 +495,18 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1111096815} m_CullTransparentMesh: 1 +--- !u!114 &1111096820 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111096815} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ebc1ff2ca6301ea418d24447257776ae, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1464315473 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen.cs b/Assets/Scripts/GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen.cs index f147f47..8768b9d 100644 --- a/Assets/Scripts/GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen.cs +++ b/Assets/Scripts/GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen.cs @@ -5,15 +5,7 @@ using UnityEngine.SceneManagement; public class GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen : MonoBehaviour { - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - + public void r() { + SceneManager.LoadScene(0); } } diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index 905b293..413fc63 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System; using UnityEngine; using UnityEngine.Events; +using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { @@ -12,12 +13,15 @@ public class GameManager : MonoBehaviour private string penisSuriveTime = ""; + public int Revives { get; private set; } + void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); + Revives = 0; } else { @@ -29,12 +33,30 @@ public class GameManager : MonoBehaviour { } - public void playerDied(int who) + public void playerDied(GameObject who) { - Debug.Break(); + if (Revives == 0) + SceneManager.LoadScene(3); + else { + Revives--; + Collider2D[] d = Physics2D.OverlapCircleAll(who.transform.position, 5f); + + foreach (Collider2D c in d) { + if (c.gameObject.CompareTag("Enemy")) { + c.gameObject.GetComponent().TakeDamage(9999999999); + } + } + + var g = who.GetComponent(); + // heal + g.setMaxHealth(g.getMaxHealth(), true); + + // REVIVE SOUND HERE + } } - public void setTime(string t) { + public void setTime(string t) + { penisSuriveTime = t; } diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 3890ce8..9621f07 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -14,7 +14,6 @@ public class PlayerMovement : MonoBehaviour private bool right = false; - [Header("Whipping")] [SerializeField] RopeWhipAttack whipAttack; @@ -37,6 +36,7 @@ public class PlayerMovement : MonoBehaviour rb = GetComponent(); playerInput = GetComponent(); hp = GetComponent(); + attack = GetComponent(); if (gameObject.name == "Player2") {