mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-19 20:27:14 +08:00
Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com>
22 lines
640 B
C#
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);
|
|
}
|
|
}
|
|
} |