| | | 1 | | using CounterDrone.Core.Models; |
| | | 2 | | |
| | | 3 | | namespace CounterDrone.Core.Simulation |
| | | 4 | | { |
| | | 5 | | public class PlatformEntity |
| | | 6 | | { |
| | 11 | 7 | | public string Id { get; } |
| | 0 | 8 | | public EquipmentRole Role { get; } |
| | 11 | 9 | | public PlatformType? PlatformType { get; } |
| | 27 | 10 | | public float PosX { get; private set; } |
| | 27 | 11 | | public float PosY { get; private set; } |
| | 27 | 12 | | public float PosZ { get; private set; } |
| | 11 | 13 | | public AerosolType? AerosolType { get; } |
| | 49 | 14 | | public int MunitionCount { get; private set; } |
| | 11 | 15 | | public float Cooldown { get; } |
| | 8438 | 16 | | public float CooldownRemaining { get; private set; } |
| | 11 | 17 | | public bool Ready => CooldownRemaining <= 0 && MunitionCount > 0; |
| | | 18 | | |
| | 16 | 19 | | public PlatformEntity(string id, EquipmentDeployment config) |
| | 16 | 20 | | { |
| | 16 | 21 | | Id = id; |
| | 16 | 22 | | Role = (EquipmentRole)config.EquipmentRole; |
| | 16 | 23 | | PlatformType = config.PlatformType.HasValue ? (PlatformType?)config.PlatformType.Value : null; |
| | 16 | 24 | | PosX = (float)config.PositionX; |
| | 16 | 25 | | PosY = (float)config.PositionY; |
| | 16 | 26 | | PosZ = (float)config.PositionZ; |
| | 16 | 27 | | AerosolType = config.AerosolType.HasValue ? (AerosolType?)config.AerosolType.Value : null; |
| | 16 | 28 | | MunitionCount = config.MunitionCount ?? 3; |
| | 16 | 29 | | Cooldown = (float)config.Cooldown; |
| | 16 | 30 | | } |
| | | 31 | | |
| | | 32 | | public void Update(float deltaTime) |
| | 7844 | 33 | | { |
| | 7844 | 34 | | if (CooldownRemaining > 0) |
| | 286 | 35 | | CooldownRemaining -= deltaTime; |
| | 7844 | 36 | | } |
| | | 37 | | |
| | | 38 | | public void Fire() |
| | 11 | 39 | | { |
| | 11 | 40 | | MunitionCount--; |
| | 11 | 41 | | CooldownRemaining = Cooldown; |
| | 11 | 42 | | } |
| | | 43 | | } |
| | | 44 | | } |