using ProjectM.Simulation; using Unity.Entities; using UnityEngine; namespace ProjectM.Authoring { /// /// Authoring for the baked singleton (mirrors ResourceFieldSpawnerAuthoring). /// Place once in the gameplay subscene and assign the Blight-clutter ghost prefab; ExpeditionFieldSystem /// scatters the clutter each expedition alongside the resource field. Carries no transform. /// public class ClutterFieldSpawnerAuthoring : MonoBehaviour { [Tooltip("Blight-clutter ghost prefab. Must carry BlightClutterAuthoring + a GhostAuthoringComponent (ownerless, interpolated).")] public GameObject ClutterPrefab; [Tooltip("Number of clutter pieces per expedition.")] [Min(1)] public int Count = 14; [Tooltip("Scatter radius (world units) around the expedition origin.")] [Min(1f)] public float Radius = 14f; private class ClutterFieldSpawnerBaker : Baker { public override void Bake(ClutterFieldSpawnerAuthoring authoring) { var entity = GetEntity(authoring, TransformUsageFlags.None); AddComponent(entity, new ClutterFieldSpawner { Prefab = authoring.ClutterPrefab != null ? GetEntity(authoring.ClutterPrefab, TransformUsageFlags.Dynamic) : Entity.Null, Count = authoring.Count, Radius = authoring.Radius, }); } } } }