| | | 1 | | using System.Collections.Generic; |
| | | 2 | | |
| | | 3 | | namespace CounterDrone.Core.Simulation |
| | | 4 | | { |
| | | 5 | | public enum SimulationState |
| | | 6 | | { |
| | | 7 | | Idle, Running, Paused, Stopped, Completed, |
| | | 8 | | } |
| | | 9 | | |
| | | 10 | | public class SimEvent |
| | | 11 | | { |
| | | 12 | | public Models.SimEventType Type { get; set; } |
| | | 13 | | public float OccurredAt { get; set; } |
| | | 14 | | public string SourceId { get; set; } = string.Empty; |
| | | 15 | | public string TargetId { get; set; } = string.Empty; |
| | | 16 | | public string DataJson { get; set; } = "{}"; |
| | | 17 | | public string Description { get; set; } = string.Empty; |
| | | 18 | | } |
| | | 19 | | |
| | | 20 | | public class EventQueue |
| | | 21 | | { |
| | 0 | 22 | | private readonly Queue<SimEvent> _queue = new(); |
| | 0 | 23 | | public void Enqueue(SimEvent e) => _queue.Enqueue(e); |
| | 0 | 24 | | public SimEvent Dequeue() => _queue.Dequeue(); |
| | 0 | 25 | | public int Count => _queue.Count; |
| | 0 | 26 | | public bool HasEvents => _queue.Count > 0; |
| | 0 | 27 | | public void Clear() => _queue.Clear(); |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | public class SimulationFrameResult |
| | | 31 | | { |
| | | 32 | | public List<EntitySnapshot> EntitySnapshots { get; set; } = new(); |
| | | 33 | | public List<SimEvent> NewEvents { get; set; } = new(); |
| | | 34 | | public SimulationState State { get; set; } |
| | | 35 | | public int FrameIndex { get; set; } |
| | | 36 | | public float SimulationTime { get; set; } |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | public class EntitySnapshot |
| | | 40 | | { |
| | | 41 | | public string EntityId { get; set; } = string.Empty; |
| | | 42 | | public Models.EntityType EntityType { get; set; } |
| | | 43 | | public float PosX { get; set; } |
| | | 44 | | public float PosY { get; set; } |
| | | 45 | | public float PosZ { get; set; } |
| | | 46 | | public float RotX { get; set; } |
| | | 47 | | public float RotY { get; set; } |
| | | 48 | | public float RotZ { get; set; } |
| | | 49 | | public string StateData { get; set; } = "{}"; |
| | | 50 | | } |
| | | 51 | | |
| | | 52 | | public enum DroneStatus |
| | | 53 | | { |
| | | 54 | | Flying, Destroyed, ReachedTarget, ZoneIntruded, |
| | | 55 | | } |
| | | 56 | | } |