Managed the freeing of entityplacers. Also cleaned up EntityManager
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Babushka.scripts.CSharp.GameEntity.Entities;
|
||||
|
||||
public class LoadedScenesEntity : Entity
|
||||
{
|
||||
private HashSet<string> _loadedScenes = new();
|
||||
public override string EntityType => "LoadedScenesEntity";
|
||||
|
||||
public void AddScene(string sceneName) => _loadedScenes.Add(sceneName);
|
||||
|
||||
public bool WasSceneLoaded(string sceneName) => _loadedScenes.Contains(sceneName);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://rabb1y637cm5
|
||||
@@ -28,6 +28,6 @@ public abstract class PositionalEntity : Entity
|
||||
}
|
||||
|
||||
// Deals with Instantiation of the node
|
||||
public abstract void AddEntity(Node2D parent);
|
||||
public abstract void InstantiateEntityNode(Node2D parent);
|
||||
|
||||
}
|
||||
@@ -13,10 +13,10 @@ public class TrashEntity : PositionalEntity
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddEntity(Node2D parent)
|
||||
public override void InstantiateEntityNode(Node2D parent)
|
||||
{
|
||||
if(_creator == null) _creator = EntityManager.Instance.NodeCreator;
|
||||
var entityNode = _creator.CreateNode2D(EntityType);
|
||||
var entityNode = _creator.InstantiateNode(EntityType);
|
||||
parent.AddChild(entityNode);
|
||||
entityNode.GlobalPosition = position;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user