using ProjectM.Simulation; using Unity.Entities; using UnityEngine; namespace ProjectM.Authoring { /// /// Authoring for the training-dummy enemy prefab. Bakes a stationary, damageable auto-target /// candidate: marks it for the ability auto-target cone, /// and make it a valid projectile hit target, and a /// buffer receives server-authoritative hits. Dummies are NOT ghosts and /// carry no GhostOwner, so projectiles never treat them as the firing owner. /// GetEntity(TransformUsageFlags.Dynamic) ensures a runtime LocalTransform for hit tests /// and spawn placement. /// public class TrainingDummyAuthoring : MonoBehaviour { [Min(0f), Tooltip("Starting and maximum health for the dummy.")] public float MaxHealth = 60f; [Min(0f), Tooltip("World-unit radius used by the projectile hit test.")] public float HitRadius = 0.8f; private class TrainingDummyBaker : Baker { public override void Bake(TrainingDummyAuthoring authoring) { var entity = GetEntity(authoring, TransformUsageFlags.Dynamic); AddComponent(entity); AddComponent(entity, new Health { Current = authoring.MaxHealth, Max = authoring.MaxHealth }); AddComponent(entity, new HitRadius { Value = authoring.HitRadius }); AddBuffer(entity); } } } }