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