using Cirno.Scripts.Components.FSM; using Cirno.Scripts.Components.FSM.Enemy._3D; using Cirno.Scripts.Enums; using Cirno.Scripts.Resources; using Cirno.Scripts.Resources.Loot; using Godot; namespace Cirno.Scripts.Components.Actors._3D; public partial class EnemyDropModule3D : ModuleBase { [Export] public EnemyStorage3D StorageModule { get; private set; } /// Radius of the circle in which dropped items are scattered uniformly. [Export] public float LootScatterRadius { get; set; } = 1.0f; /// Initial upward speed applied to each dropped item so it pops up before falling. [Export] public float LootLaunchUpSpeed { get; set; } = 3.0f; private bool _initialized = false; private bool _enabled = false; private RandomNumberGenerator _rng = new(); public override void EnterState(EnemyState state) { _enabled = true; LootDropHelper.SpawnDrops( StorageModule.LootDrops, _machine.MainObject, _machine.MainObject.GlobalPosition, LootScatterRadius, LootLaunchUpSpeed, _rng); } public override void ExitState(EnemyState state) { _enabled = false; } private IStateMachine _machine; public override void Init(IStateMachine machine) { if (_initialized) return; _machine = machine; } public override void Process(double delta) { } public override void PhysicsProcess(double delta) { } }