Fixed level restart
This commit is contained in:
parent
1d578fcba4
commit
e8df5f1183
3 changed files with 13 additions and 5 deletions
|
|
@ -121,9 +121,9 @@ locale/translations=PackedStringArray("res://translations/plants.en.translation"
|
|||
|
||||
2d_physics/layer_1="Reserved"
|
||||
2d_physics/layer_2="Plants Dummy"
|
||||
2d_physics/layer_3="Plants Full"
|
||||
2d_physics/layer_3="Plants True"
|
||||
2d_physics/layer_4="Zombies Dummy"
|
||||
2d_physics/layer_5="Zombies Full"
|
||||
2d_physics/layer_5="Zombies True"
|
||||
2d_physics/layer_7="FallLine"
|
||||
2d_physics/layer_8="FallParticles"
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,14 @@ public partial class LevelController : Node
|
|||
|
||||
_isLevelRunning = true;
|
||||
}
|
||||
|
||||
public void RestartLevel()
|
||||
{
|
||||
if (_isLevelRunning == false)
|
||||
return;
|
||||
var resource = RuntimeLevelData.LevelResource;
|
||||
GetTree().ReloadCurrentScene();
|
||||
RuntimeLevelData.LevelResource = resource;
|
||||
}
|
||||
public void EndLevel()
|
||||
{
|
||||
if (_isLevelRunning == false)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Godot;
|
||||
using Newlon;
|
||||
using System;
|
||||
|
||||
public partial class PauseMenu : Control
|
||||
|
|
@ -21,7 +22,7 @@ public partial class PauseMenu : Control
|
|||
public void Restart()
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
GetTree().ReloadCurrentScene();
|
||||
LevelController.Instance.RestartLevel();
|
||||
currently_paused = false;
|
||||
}
|
||||
public void Exit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue