First adjustments to the Entity System to make it work with different types
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using Babushka.scripts.CSharp.GameEntity.Management;
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.GameEntity.Entities;
|
||||
|
||||
public class TrashEntity : PositionalEntity
|
||||
{
|
||||
public override string EntityType => OWN_TYPE_NAME;
|
||||
public const string OWN_TYPE_NAME = "TrashEntity";
|
||||
private EntityNodeCreator _creator;
|
||||
|
||||
public TrashEntity()
|
||||
{
|
||||
}
|
||||
|
||||
public override void AddEntity(Node2D parent)
|
||||
{
|
||||
if(_creator == null) _creator = EntityManager.Instance.NodeCreator;
|
||||
var entityNode = _creator.CreateNode2D(EntityType);
|
||||
parent.AddChild(entityNode);
|
||||
entityNode.GlobalPosition = position;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user