using ProjectM.Simulation; using Unity.Entities; using UnityEngine; namespace ProjectM.Authoring { /// /// Authoring for the baked singleton (mirrors ClutterFieldSpawnerAuthoring). /// Place once in the gameplay subscene and assign the CoverRock ghost prefab; RoomFieldSystem scatters /// destructible cover per room (never in Boss rooms) with an origin keep-out. Carries no transform. /// public class CoverFieldSpawnerAuthoring : MonoBehaviour { [Tooltip("CoverRock ghost prefab: BlightClutterAuthoring (ScrapPerHit=0, Variant=4) + an Environment-layer collider + a GhostAuthoringComponent (ownerless, interpolated).")] public GameObject CoverPrefab; [Tooltip("Cover rocks per room (Boss rooms get none).")] [Min(0)] public int Count = 3; private class CoverFieldSpawnerBaker : Baker { public override void Bake(CoverFieldSpawnerAuthoring authoring) { var entity = GetEntity(authoring, TransformUsageFlags.None); AddComponent(entity, new CoverFieldSpawner { Prefab = authoring.CoverPrefab != null ? GetEntity(authoring.CoverPrefab, TransformUsageFlags.Dynamic) : Entity.Null, Count = authoring.Count, }); } } } }