Files
Gen_Hack-and-Slash-Roguelite/Client/Assets/Scripts/Managers/Generator.cs

22 lines
640 B
C#
Raw Normal View History

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);
}
}
}