complete refactor

This commit is contained in:
Rendo 2025-07-25 18:48:49 +05:00
commit de2e8b1e50
71 changed files with 212 additions and 137 deletions

View file

@ -1,5 +1,6 @@
using Godot;
using Newlon;
using Newlon.Resources;
using Newlon.Components;
using Newlon.Components.Level;
using Newlon.Components.Plants;

View file

@ -1,5 +1,6 @@
using Godot;
using Newlon.Components.Level;
using Newlon.Resources;
namespace Newlon;

View file

@ -1,6 +1,8 @@
using Godot;
using Newlon.Components.Zombies;
using System.Collections.Generic;
using Newlon.Resources;
using Newlon.Components.Droppables;
namespace Newlon.Components.Level;

View file

@ -1,18 +1,19 @@
using Godot;
using Newlon.Components.GUI.Seedpackets;
using Newlon.Components.Plants;
using Newlon.Resources;
namespace Newlon.Components.Level;
public partial class PlantField : Node2D
{
private Node2D _plantSetter;
private EntityResource _resource;
private GridEntityResource _resource;
private Seedpacket _slot;
private bool _previousCanPlace;
private ChannelPlayer player;
[Export] private PackedScene particles;
public static PlantField Instance {get; private set;}
public static PlantField Instance { get; private set; }
public override void _Ready()
{
@ -21,13 +22,13 @@ public partial class PlantField : Node2D
player = GetNode<ChannelPlayer>("PlantPlayer");
}
public void SetPlant(Seedpacket slot, EntityResource resource)
public void SetPlant(Seedpacket slot, GridEntityResource resource)
{
_resource = resource;
_slot = slot;
if (resource == null)
{
foreach(var child in _plantSetter.GetChildren())
foreach (var child in _plantSetter.GetChildren())
child.QueueFree();
}
else
@ -40,7 +41,7 @@ public partial class PlantField : Node2D
public void ResetPlant()
{
SetPlant(null,null);
SetPlant(null, null);
}
public override void _Process(double delta)
@ -99,7 +100,7 @@ public partial class PlantField : Node2D
RuntimeLevelData.Instance.SpendSun((int)_resource.Cost);
PoolContainer.Instance.SpawnParticles(particles, plant.GlobalPosition + Vector2.Down * FieldParams.TileHeight/2.0f);
PoolContainer.Instance.SpawnParticles(particles, plant.GlobalPosition + Vector2.Down * FieldParams.TileHeight / 2.0f);
player.Play();

View file

@ -1,5 +1,6 @@
using Godot;
using System.Collections.Generic;
using Newlon.Particles;
namespace Newlon.Components.Level;

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon.Projectiles;
namespace Newlon.Components.Level;

View file

@ -2,6 +2,7 @@ using Godot;
using System.Collections.Generic;
using Newlon.Components.Zombies;
using Godot.Collections;
using Newlon.Resources;
namespace Newlon.Components.Level;

View file

@ -1,6 +1,8 @@
using System.Collections.Generic;
using Godot;
using Godot.Collections;
using Newlon;
using Newlon.Resources;
public partial class SurvivalZombieSpawner : Node
{