game registry internal refactor

This commit is contained in:
Rendo 2025-07-25 18:02:47 +05:00
commit d5573db251
11 changed files with 68 additions and 188 deletions

View file

@ -1,4 +1,5 @@
using Godot;
using Newlon;
using Newlon.Components;
using Newlon.Components.Level;
using Newlon.Components.Plants;
@ -37,7 +38,7 @@ public partial class InitialPackedSceneSpawner : Node
{
PoolContainer.Instance.Plants.AddChild(plant);
node.GlobalPosition = position;
plant.Resource = GameRegistry.GetPlantByName(plant.internal_id);
plant.Resource = GameRegistry.GetEntityByName(plant.internal_id) as PlantResource;
PoolContainer.Instance.EntityField[plant.Resource.Layer].Add(plant.GlobalPosition, plant);
}
else

View file

@ -163,7 +163,7 @@ public partial class SurvivalZombieSpawner : Node
List<ZombieResource> list = [];
foreach (var res in pool)
{
list.Add(GameRegistry.GetZombieByName(res));
list.Add(GameRegistry.GetEntityByName(res) as ZombieResource);
}
return list;
}

View file

@ -58,7 +58,7 @@ public partial class ZombieSequencer : Node2D
private void Spawn(string id, int lane)
{
RuntimeZombieData zombie = GameRegistry.GetZombieByName(id).Scene.Instantiate<RuntimeZombieData>();
RuntimeZombieData zombie = GameRegistry.GetEntityByName(id).Scene.Instantiate<RuntimeZombieData>();
PoolContainer.Instance.Zombies.AddChild(zombie);
zombie.GlobalPosition = new Vector2(GlobalPosition.X, FieldParams.RightFieldBoundary.Y - (lane - 1) * FieldParams.TileHeight);