mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
nya
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class GameOver : MonoBehaviour
|
||||
{
|
||||
public GameObject deathMenu;
|
||||
|
||||
// Update is called once per frame
|
||||
public void Death()
|
||||
{
|
||||
deathMenu.SetActive(true);
|
||||
Time.timeScale = 0f;
|
||||
}
|
||||
|
||||
public void ResumeGame()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
||||
}
|
||||
|
||||
public void ReturnToMain()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene("Main Menu");
|
||||
}
|
||||
|
||||
public void ReturnToReal()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7022d1c19583f4f4195dc0f83d48c325
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,6 +11,8 @@ public class Health : MonoBehaviour {
|
||||
public bool isDead;
|
||||
public UnityEvent OnDead = new UnityEvent();
|
||||
public UnityEvent OnHit = new UnityEvent();
|
||||
public GameObject three,two,one,zero;
|
||||
public AudioManager audioManager;
|
||||
|
||||
void Start() {
|
||||
currentHealth = startingHealth;
|
||||
@@ -27,6 +29,22 @@ public class Health : MonoBehaviour {
|
||||
currentHealth = Mathf.Clamp(currentHealth - 1, 0, startingHealth);
|
||||
isDead = currentHealth <= 0;
|
||||
OnHit.Invoke();
|
||||
if (currentHealth == 2)
|
||||
{
|
||||
three.SetActive(false);
|
||||
two.SetActive(true);
|
||||
}
|
||||
if (currentHealth == 1)
|
||||
{
|
||||
two.SetActive(false);
|
||||
one.SetActive(true);
|
||||
}
|
||||
if (currentHealth == 0)
|
||||
{
|
||||
one.SetActive(false);
|
||||
zero.SetActive(true);
|
||||
}
|
||||
audioManager.Play("pencilbreak");
|
||||
if (isDead) OnDead.Invoke();
|
||||
StartCoroutine(damageTimer());
|
||||
}
|
||||
|
||||
@@ -39,4 +39,10 @@ public class MenuController : MonoBehaviour
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene("Main Menu");
|
||||
}
|
||||
|
||||
public void ReturnToReal()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene("Real World");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class WorldScreenController : MonoBehaviour
|
||||
{
|
||||
if (currentLevel >= 6)
|
||||
{
|
||||
SceneManager.LoadScene("Heights Level");
|
||||
SceneManager.LoadScene("Crowds Level");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user