1
0
Fork 0

Respawn with R

This commit is contained in:
Piegames 2018-04-24 17:48:22 +02:00
parent eac05d6bfe
commit a0c086149a
2 changed files with 10 additions and 2 deletions

View file

@ -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();

View file

@ -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);