Files
Gen_Hack-and-Slash-Roguelite/Client/Assets/Scripts/Managers/Generator.cs
2025-07-21 13:58:58 +08:00

22 lines
640 B
C#

using Prefab;
using UnityEngine;
namespace Managers
{
public class Generator:MonoBehaviour
{
public GameObject entityLevel;
public EntityPrefab entityPrefab;
public void GenerateEntity(Data.PawnDef pawnDef, Vector3 pos)
{
if (entityPrefab == null || pawnDef == null)
return;
GameObject entity = Instantiate(entityPrefab.gameObject, pos, Quaternion.identity, entityLevel.transform);
// entity.name = pawnDef.name;
var entityComponent = entity.GetComponent<EntityPrefab>();
entityComponent?.Init(pawnDef);
}
}
}