using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
///
/// MC-1 — marks a Husk prefab as a CHARGER variant. Compose this WITH on the
/// prefab root (both bakers share the primary entity): EnemyAuthoring bakes the common Husk components and
/// Charger-tuned stats; this bakes the server-only (zeroed = not lunging).
/// Component-PRESENCE is the discriminator EnemyAISystem branches on — no enum/brain byte (the Burst
/// cross-assembly-enum hazard) — routing the Charger to the commit→lunge→whiff-stagger pass while the Grunt
/// pass excludes it via .WithNone<LungeState>(). NOT a [GhostField]: the lunged position
/// replicates via stock LocalTransform like every Husk.
///
public class ChargerAuthoring : MonoBehaviour
{
private class ChargerBaker : Baker
{
public override void Bake(ChargerAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent(entity);
// Slice 1 (Feature D): the replicated mid-lunge cue, baked DISABLED (a Charger spawns not-lunging).
// EnemyAISystem derives the bit each tick from LungeState.UntilTick (visiting disabled entities via
// .WithPresent()). Adding this [GhostEnabledBit] changes the Charger ghost hash -> RE-BAKE.
AddComponent(entity);
SetComponentEnabled(entity, false);
}
}
}
}