private void Run() { while (true) { lock ( lockObject ) { if (entries.Count == 0) { if (!isRunning) { break; } } else { try { var entry = entries.Dequeue(); if (targets.HasFlag(Targets.Console)) { entry.WriteToConsole(); } if (targets.HasFlag(Targets.File)) { entry.WriteToFile(id); } } catch (Exception exception) { Console.WriteLine(exception); isRunning = false; } } } Thread.Sleep(10); } }
/// <summary> /// Can this ability target something? /// </summary> /// <param name="target"></param> /// <returns></returns> public bool CanTarget(AbilityTargets target) { return(Targets.HasFlag(target)); }