using System; using Godot; using Godot.Collections; namespace Babushka.scripts.CSharp.GameEntity.Management; public partial class EntityNodeCreator : Node { [Export] private Dictionary _entityPrefabs; public Node2D InstantiateNode(string type) { if (string.IsNullOrEmpty(type)) { throw new NullReferenceException("The type provided for Node instantiation cannot be null or empty."); } if (!_entityPrefabs.ContainsKey(type)) { throw new Exception($"The type provided for Node instantiation ({type}) is not specified in the EntityNodeCreator dictionary."); } return _entityPrefabs[type].Instantiate(); } }