using ProjectM.Simulation; using Unity.Entities; using UnityEngine; namespace ProjectM.Authoring { /// /// MC-2 — authoring for the subscene singleton. Place ONE on a GameObject in /// the gameplay subscene; the server EnemyAISystem Spitter pass reads it via GetSingleton to know which spit /// ghost to instantiate and the concurrent soft-cap. The referenced prefab is the EnemyProjectile ghost /// (EnemyProjectileAuthoring); MaxLiveProjectiles bounds the relevancy loop — a Spitter at/over the cap soft-fails /// its shot (no cooldown burn). The carrying entity has no transform; only the referenced prefab needs one. /// public class SpitterProjectilePrefabAuthoring : MonoBehaviour { [Tooltip("The EnemyProjectile ghost prefab that Spitters fire (must carry EnemyProjectileAuthoring + an interpolated GhostAuthoringComponent).")] public GameObject ProjectilePrefab; [Min(1), Tooltip("Max concurrent live spit projectiles across all Spitters (soft-cap; over it a Spitter soft-fails its shot).")] public int MaxLiveProjectiles = 24; private class SpitterProjectilePrefabBaker : Baker { public override void Bake(SpitterProjectilePrefabAuthoring authoring) { var entity = GetEntity(authoring, TransformUsageFlags.None); AddComponent(entity, new SpitterProjectilePrefab { Prefab = authoring.ProjectilePrefab != null ? GetEntity(authoring.ProjectilePrefab, TransformUsageFlags.Dynamic) : Entity.Null, MaxLiveProjectiles = authoring.MaxLiveProjectiles, }); } } } }