Respawn with R
This commit is contained in:
parent
eac05d6bfe
commit
a0c086149a
2 changed files with 10 additions and 2 deletions
|
@ -25,6 +25,10 @@ public class Player : Mob {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
|
if (Input.GetAxis("Reset") > 0)
|
||||||
|
{
|
||||||
|
GameController.instance.GetUI().Restart();
|
||||||
|
}
|
||||||
if ( Time.timeSinceLevelLoad >= nextAttackTime && attack != null) {
|
if ( Time.timeSinceLevelLoad >= nextAttackTime && attack != null) {
|
||||||
if ( Input.GetAxis("Fire") > 0 ) {
|
if ( Input.GetAxis("Fire") > 0 ) {
|
||||||
attack.Attack();
|
attack.Attack();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class UIController : MonoBehaviour
|
||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
if (Input.GetAxis("Reset") > 0 && GameController.instance.GameEnded()) {
|
if (Input.GetAxis("Reset") > 0 && GameController.instance.GameEnded()) {
|
||||||
LoadSceneByIndex(firstSceneIndex);
|
Restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,10 @@ public class UIController : MonoBehaviour
|
||||||
pauseMenu.SetActive(false);
|
pauseMenu.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Restart() {
|
||||||
|
LoadSceneByIndex(firstSceneIndex);
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadSceneByIndex(int index) {
|
public void LoadSceneByIndex(int index) {
|
||||||
Debug.Log("Loaded scene " + index);
|
Debug.Log("Loaded scene " + index);
|
||||||
SceneManager.LoadScene(index);
|
SceneManager.LoadScene(index);
|
||||||
|
|
Loading…
Add table
Reference in a new issue