using ProjectM.Simulation;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
namespace ProjectM.Authoring
{
///
/// MC-2 — authoring for the hostile Spitter projectile prefab (an ownerless INTERPOLATED ghost, duplicated from an
/// existing interpolated ghost so the GhostAuthoringComponent comes free). Bakes with
/// the spit's default Speed/Damage/Range; the firing Spitter OVERRIDES Direction + Speed + Damage + Region at spawn
/// and ADDS the RegionTag (so this prefab MUST NOT bake RegionTag — AddComponent would throw on a baked one).
/// NO Health (so it is invisible to every player hit-test) and NO [GhostField] beyond the stock LocalTransform.
///
public class EnemyProjectileAuthoring : MonoBehaviour
{
[Min(0f), Tooltip("Default muzzle speed (the firing Spitter overrides this per-variant).")]
public float Speed = 11f;
[Min(0f), Tooltip("Default damage (the firing Spitter overrides this from its AttackDamage).")]
public float Damage = 8f;
[Min(0f), Tooltip("Max travel distance before the spit expires (world units).")]
public float Range = 16f;
private class EnemyProjectileBaker : Baker
{
public override void Bake(EnemyProjectileAuthoring authoring)
{
var entity = GetEntity(authoring, TransformUsageFlags.Dynamic);
AddComponent(entity, new EnemyProjectile
{
Speed = authoring.Speed,
Damage = authoring.Damage,
Range = authoring.Range,
Direction = new float2(0f, 1f),
DistanceTravelled = 0f,
LastStep = 0f,
Region = 0,
});
}
}
}
}