using System.Collections.Generic;
using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
///
/// Bakes the Enemy-test GYM singletons: the mode switch + the
/// buffer of on-demand-spawnable enemy prefabs (Drowner / Grindylow — the ready skinned prefabs). Place ONE in
/// the gym subscene. Each prefab must be a baked ghost (interpolated ownerless enemy, EnemyAuthoring-based). The
/// SpawnEnemy dev op instantiates the row whose Kind matches the request.
///
public class GymRosterAuthoring : MonoBehaviour
{
[System.Serializable]
public struct Entry
{
[Tooltip("Stable kind id (0 = Drowner, 1 = Grindylow).")]
public byte Kind;
public GameObject Prefab;
}
[Tooltip("On-demand-spawnable enemy prefabs, one row per kind.")]
public List Enemies = new List();
private class RosterBaker : Baker
{
public override void Bake(GymRosterAuthoring authoring)
{
var entity = GetEntity(TransformUsageFlags.None);
AddComponent(entity);
var buf = AddBuffer(entity);
if (authoring.Enemies != null)
{
foreach (var e in authoring.Enemies)
{
if (e.Prefab == null) continue;
buf.Add(new GymEnemyRoster
{
Kind = e.Kind,
Prefab = GetEntity(e.Prefab, TransformUsageFlags.Dynamic),
});
}
}
}
}
}
}