using ProjectM.Simulation;
using Unity.Entities;
using UnityEngine;
namespace ProjectM.Authoring
{
///
/// Authoring for a player-cast ZONE ghost (Vortex / LightZone — the LANTERN Aoe/zone Sparks). Bakes an inert
/// ; the runtime values (caster / radius / damage / lifetime) are stamped at spawn by
/// AbilityFireSystem — only the Vortex FLAG is authored here (so AbilityFireSystem can pick
/// ZoneEffect vs DecoyTag by prefab membership, and the pull behaviour is baked-in). The prefab's ghost setup
/// (GhostAuthoringComponent: interpolated, ownerless) is inherited by DUPLICATING an existing ownerless
/// interpolated ghost, so position replicates via the stock LocalTransform variant. 07-21 G6: ZoneEffect's
/// CasterNetworkId / Radius / NextTick are hand-written [GhostField]s (the client fill telegraph). GetEntity(Dynamic) gives a runtime-mutable LocalTransform for the spawn override.
///
public class ZoneAuthoring : MonoBehaviour
{
[Tooltip("Vortex: pull enemies toward the zone centre each tick (in addition to the periodic damage).")]
public bool Vortex = false;
private class ZoneBaker : Baker
{
public override void Bake(ZoneAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent(entity, new ZoneEffect
{
Flags = authoring.Vortex ? ZoneEffectFlag.Vortex : (byte)0,
// caster / radius / damage / NextTick / ExpireTick are seeded at spawn by AbilityFireSystem.
});
}
}
}
}