loose menu
This commit is contained in:
parent
6608fb8389
commit
a6f817efbc
17 changed files with 369 additions and 52 deletions
10
scripts/components/gui/ExitButton.cs
Normal file
10
scripts/components/gui/ExitButton.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class ExitButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
}
|
||||
1
scripts/components/gui/ExitButton.cs.uid
Normal file
1
scripts/components/gui/ExitButton.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dpdpv2oyxdna7
|
||||
|
|
@ -21,8 +21,7 @@ public partial class PauseMenu : Control
|
|||
}
|
||||
public void Exit()
|
||||
{
|
||||
GetNode<AudioStreamPlayer>("Audio").Play();
|
||||
GetNode<AudioStreamPlayer>("Audio").Finished += () => { GetTree().Quit(); };
|
||||
GetTree().Quit();
|
||||
}
|
||||
public static void Pause()
|
||||
{
|
||||
|
|
|
|||
12
scripts/components/gui/RestartButton.cs
Normal file
12
scripts/components/gui/RestartButton.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class RestartButton : Button
|
||||
{
|
||||
public override void _Pressed()
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
GetTree().ReloadCurrentScene();
|
||||
}
|
||||
|
||||
}
|
||||
1
scripts/components/gui/RestartButton.cs.uid
Normal file
1
scripts/components/gui/RestartButton.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://btqwxelqxheh3
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
1
scripts/components/level/LoseCheckbox.cs.uid
Normal file
1
scripts/components/level/LoseCheckbox.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://812ldoyxd5n5
|
||||
17
scripts/components/plants/LoseZone.cs
Normal file
17
scripts/components/plants/LoseZone.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using Godot;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class LoseZone : RuntimePlantData
|
||||
{
|
||||
public override void TakeDamage(int amount, Node origin, Utility.DamageTypes damageType = Utility.DamageTypes.PHYSICAL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Kill()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
scripts/components/plants/LoseZone.cs.uid
Normal file
1
scripts/components/plants/LoseZone.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c0ov2bq5er0gh
|
||||
|
|
@ -25,7 +25,7 @@ public partial class RuntimePlantData : Node2D, IEntity
|
|||
_hp = _maxHP;
|
||||
}
|
||||
|
||||
public void Heal(int amount, Node origin)
|
||||
public virtual void Heal(int amount, Node origin)
|
||||
{
|
||||
_hp += amount;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ public partial class RuntimePlantData : Node2D, IEntity
|
|||
}
|
||||
}
|
||||
|
||||
public void TakeDamage(int amount, Node origin, Utility.DamageTypes damageType = Utility.DamageTypes.PHYSICAL)
|
||||
public virtual void TakeDamage(int amount, Node origin, Utility.DamageTypes damageType = Utility.DamageTypes.PHYSICAL)
|
||||
{
|
||||
_hp -= amount;
|
||||
|
||||
|
|
@ -48,18 +48,18 @@ public partial class RuntimePlantData : Node2D, IEntity
|
|||
Kill();
|
||||
}
|
||||
}
|
||||
public void Kill()
|
||||
public virtual void Kill()
|
||||
{
|
||||
PoolContainer.Instance.EntityField[Resource.Layer].Remove(GlobalPosition);
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
public void DisableBrain()
|
||||
public virtual void DisableBrain()
|
||||
{
|
||||
GetNode<Node>("Behaviour").ProcessMode = ProcessModeEnum.Disabled;
|
||||
}
|
||||
|
||||
public void EnableBrain()
|
||||
public virtual void EnableBrain()
|
||||
{
|
||||
GetNode<Node>("Behaviour").ProcessMode = ProcessModeEnum.Inherit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue