This commit is contained in:
SpoodyTheOne 2024-02-04 10:31:50 +01:00
parent 6b07e3b115
commit f4db945309
4 changed files with 55 additions and 15 deletions

View File

@ -372,6 +372,7 @@ GameObject:
- component: {fileID: 1111096819} - component: {fileID: 1111096819}
- component: {fileID: 1111096818} - component: {fileID: 1111096818}
- component: {fileID: 1111096817} - component: {fileID: 1111096817}
- component: {fileID: 1111096820}
m_Layer: 5 m_Layer: 5
m_Name: Returnbtn m_Name: Returnbtn
m_TagString: Untagged m_TagString: Untagged
@ -442,7 +443,20 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1111096818} m_TargetGraphic: {fileID: 1111096818}
m_OnClick: m_OnClick:
m_PersistentCalls: 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 --- !u!114 &1111096818
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -481,6 +495,18 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1111096815} m_GameObject: {fileID: 1111096815}
m_CullTransparentMesh: 1 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 --- !u!1 &1464315473
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -5,15 +5,7 @@ using UnityEngine.SceneManagement;
public class GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen : MonoBehaviour public class GameOverMainMenuReturnerButtonScriptForLoadingTheMainMenuSceneOnceAPlayerHasDiedAndHasThenPressedTheMainMenuButtonOnTheGameOverScreen : MonoBehaviour
{ {
// Start is called before the first frame update public void r() {
void Start() SceneManager.LoadScene(0);
{
}
// Update is called once per frame
void Update()
{
} }
} }

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
@ -12,12 +13,15 @@ public class GameManager : MonoBehaviour
private string penisSuriveTime = ""; private string penisSuriveTime = "";
public int Revives { get; private set; }
void Awake() void Awake()
{ {
if (Instance == null) if (Instance == null)
{ {
Instance = this; Instance = this;
DontDestroyOnLoad(gameObject); DontDestroyOnLoad(gameObject);
Revives = 0;
} }
else 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<HealthComponent>().TakeDamage(9999999999);
}
}
var g = who.GetComponent<HealthComponent>();
// heal
g.setMaxHealth(g.getMaxHealth(), true);
// REVIVE SOUND HERE
}
} }
public void setTime(string t) { public void setTime(string t)
{
penisSuriveTime = t; penisSuriveTime = t;
} }

View File

@ -14,7 +14,6 @@ public class PlayerMovement : MonoBehaviour
private bool right = false; private bool right = false;
[Header("Whipping")] [Header("Whipping")]
[SerializeField] [SerializeField]
RopeWhipAttack whipAttack; RopeWhipAttack whipAttack;
@ -37,6 +36,7 @@ public class PlayerMovement : MonoBehaviour
rb = GetComponent<Rigidbody2D>(); rb = GetComponent<Rigidbody2D>();
playerInput = GetComponent<PlayerInput>(); playerInput = GetComponent<PlayerInput>();
hp = GetComponent<HealthComponent>(); hp = GetComponent<HealthComponent>();
attack = GetComponent<PlayerCollideAttack>();
if (gameObject.name == "Player2") if (gameObject.name == "Player2")
{ {