loose menu
This commit is contained in:
parent
6608fb8389
commit
a6f817efbc
17 changed files with 369 additions and 52 deletions
31
scripts/components/level/LoseCheckbox.cs
Normal file
31
scripts/components/level/LoseCheckbox.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Zombies;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
public partial class LoseCheckbox : Area2D
|
||||
{
|
||||
[Export] private CanvasLayer gameOverLayer;
|
||||
[Export] private AnimationPlayer fadeAnimation;
|
||||
public override void _Ready()
|
||||
{
|
||||
AreaEntered += OnAreaEntered;
|
||||
}
|
||||
|
||||
private void OnAreaEntered(Area2D area)
|
||||
{
|
||||
var parent = area.GetParent();
|
||||
if (parent != null && parent is RuntimeZombieData zombieData)
|
||||
{
|
||||
Engine.TimeScale = 1.0;
|
||||
fadeAnimation.Play("fade");
|
||||
GetTree().Paused = true;
|
||||
PhysicsServer2D.SetActive(true);
|
||||
Callable.From(()=>
|
||||
{
|
||||
zombieData.Reparent(gameOverLayer);
|
||||
}).CallDeferred();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue