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