Files
kronic f3eccec524 Slice 1: combat readability + HUD declutter (DR-038)
Four playtest do-now wins:
- Enemy health bars: pooled world-space Canvas, on-damage-sticky + fade,
  always-on <25% HP (CombatFeedbackSystem; no new replication).
- Telegraph fix: new baked client-safe EnemyTelegraph sizes the danger-cone ramp
  per enemy (0->1 ending at impact, fixes the Charger plateau); windup 18->22;
  a windup scale-pulse.
- Build-mode toggle: BuildPaletteState.PaletteOpen hides the palette by default,
  Tab / gamepad-Y toggles, with a discovery chip (HudSystem/BuildSendSystem).
- Charger committed-lunge tell: [GhostEnabledBit] IsLunging derived once/tick from
  LungeState (the Dead idiom); the danger cone persists through the lunge.

345/345 EditMode (+3 IsLunging derive tests); Play-validated: ghost-hash change
did not break the handshake, bake correct (telegraph on all enemies, IsLunging
baked-disabled on the Charger, replicated to client), no runtime errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 12:48:08 -07:00

33 lines
1.7 KiB
C#

using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
/// <summary>
/// MC-1 — marks a Husk prefab as a CHARGER variant. Compose this WITH <see cref="EnemyAuthoring"/> 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 <see cref="LungeState"/> (zeroed = not lunging).
/// Component-PRESENCE is the discriminator <c>EnemyAISystem</c> 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 <c>.WithNone&lt;LungeState&gt;()</c>. NOT a <c>[GhostField]</c>: the lunged position
/// replicates via stock LocalTransform like every Husk.
/// </summary>
public class ChargerAuthoring : MonoBehaviour
{
private class ChargerBaker : Baker<ChargerAuthoring>
{
public override void Bake(ChargerAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent<LungeState>(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<IsLunging>()). Adding this [GhostEnabledBit] changes the Charger ghost hash -> RE-BAKE.
AddComponent<IsLunging>(entity);
SetComponentEnabled<IsLunging>(entity, false);
}
}
}
}