loose menu

This commit is contained in:
Rendo 2025-06-29 01:15:45 +05:00
commit a6f817efbc
17 changed files with 369 additions and 52 deletions

View file

@ -0,0 +1,10 @@
using Godot;
using System;
public partial class ExitButton : Button
{
public override void _Pressed()
{
GetTree().Quit();
}
}

View file

@ -0,0 +1 @@
uid://dpdpv2oyxdna7

View file

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

View file

@ -0,0 +1,12 @@
using Godot;
using System;
public partial class RestartButton : Button
{
public override void _Pressed()
{
GetTree().Paused = false;
GetTree().ReloadCurrentScene();
}
}

View file

@ -0,0 +1 @@
uid://btqwxelqxheh3

View 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();
}
}
}

View file

@ -0,0 +1 @@
uid://812ldoyxd5n5

View 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()
{
}
}

View file

@ -0,0 +1 @@
uid://c0ov2bq5er0gh

View file

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