public ResourceTypes Execute() { //Console.WriteLine($"{Owner} : resources are available. Take resources : {needResources}"); StateLogger.DrawState($"{Owner} : resources are available. Take resources : {needResources}"); SemaphoreSlim.Release(); return(needResources); }
public override void Run() { while (Working) { Thread.Sleep(MinCharmTime + random.Next() % Interval); int facId = random.Next() % factories.Length; //Console.WriteLine($"{Name} : casts a charm to {factories[facId].Name}"); factories[facId].AddCharm(); // Console.WriteLine($"{Name} : Finished"); StateLogger.DrawState($"{Name} : casted a charm to {factories[facId].Name}"); } }
public override void Run() { while (Working) { Thread.Sleep(MinCharmTime + random.Next() % Interval); //Console.WriteLine($"{Name} : start taking off the charms"); foreach (var fac in factories) { fac.RemoveCharm(); } //Console.WriteLine($"{Name} : Finished"); StateLogger.DrawState($"{Name} : removed the charms"); } }