public GodOfDeath(ZooRepo zoo, int period) { Period = period; Zoo = zoo; SetWatchPeriod(Period); WatchFor(Zoo); WakeUp(); }
private void TouchSomebody(object source, ElapsedEventArgs e, ZooRepo zoo) { var victim = zoo.GetRandomAnimal(); if (victim != null) { victim.ChangeStatus(); } }
static void Main(string[] args) { // Create zoo repository var zoo = new ZooRepo(); zoo.AddAnimalsForDebug(); // Create God of death :) var Anubis = new GodOfDeath(); Anubis.SetWatchPeriod(5000); Anubis.WatchFor(zoo); Anubis.WakeUp(); // Create menu and app logic var engine = new Engine(zoo); // Run app logic engine.Run(); }
public void WatchFor(ZooRepo zoo) { Zoo = zoo; _timer.Elapsed += (sender, e) => TouchSomebody(sender, e, Zoo); }
public Engine(ZooRepo zoo) { this.zoo = zoo; }