using ProjectM.Simulation; using Unity.Entities; using UnityEngine; namespace ProjectM.Authoring { /// /// Authoring for the turret structure ghost prefab (duplicate UpgradePickup.prefab so the ownerless /// interpolated GhostAuthoringComponent comes free). Bakes {Type=Turret} + /// stats. BuildPlaceSystem stamps Cell + LastProcessedTick at placement. /// public class TurretAuthoring : MonoBehaviour { [Min(1f)] public float Range = 10f; [Min(1)] public int CooldownTicks = 30; [Min(1f)] public float Damage = 12f; private class TurretBaker : Baker { public override void Bake(TurretAuthoring authoring) { var entity = GetEntity(authoring, TransformUsageFlags.Dynamic); AddComponent(entity, new PlacedStructure { Type = StructureType.Turret, Cell = default, NextTick = 0u, LastProcessedTick = 0u, }); AddComponent(entity, new Turret { Range = authoring.Range, CooldownTicks = authoring.CooldownTicks, Damage = authoring.Damage, }); } } } }