private static void Game_OnTick(EventArgs args) { DetectedEmpoweredAttacks.RemoveAll(a => a.Ended); foreach (var attack in DetectedEmpoweredAttacks) { OnEmpoweredAttackDetected.Invoke(attack); } }
private static void Add(DetectedEmpoweredAttackData data) { if (data == null || DetectedEmpoweredAttacks.Contains(data)) { Console.WriteLine("Invalid DetectedEmpoweredAttackData"); return; } OnEmpoweredAttackDetected.Invoke(data); DetectedEmpoweredAttacks.Add(data); }
private static void Add(DetectedEmpoweredAttackData data) { if (data == null || DetectedEmpoweredAttacks.Contains(data)) { Console.WriteLine("Invalid DetectedEmpoweredAttackData"); return; } if (data.Missile != null) { var detect = DetectedEmpoweredAttacks.FirstOrDefault(a => a.Caster.IdEquals(data.Caster) && a.Missile == null && a.Data.Equals(data.Data)); if (detect != null) { DetectedEmpoweredAttacks.Remove(detect); } } OnEmpoweredAttackDetected.Invoke(data); DetectedEmpoweredAttacks.Add(data); }