/// <summary> /// Checks whether the automation was toggled /// </summary> private static void checkToggle() { if (KeybaordIO.isEnterPressed()) { HillManager.toggleAutomation(); } }
/// <summary> /// Runs the given hill's automation /// </summary> /// <param name="hill"> A hill </param> private static void runAutomation(Hill hill) { while (HillManager.isAutomationActivate()) { hill.cycle(); Thread.Sleep(HillManager.WAIT_TIME_IN_MILISECONDS); } }
/// <summary> /// Generates a hill from a file /// </summary> /// <param name="fileName"> Name of the XML file </param> /// <param name="hill"> An empty hill </param> private static void generateHill(string fileName, Hill hill) { XmlNodeList nodes = HillManager.fileNodes(fileName); foreach (XmlNode node in nodes) { if (HillManager.hasAttributes(node)) { HillManager.createRabbit(hill, node); } } }
/// <summary> /// Automates the given hill /// </summary> /// <param name="hill"> A hill </param> private static void automateHill(Hill hill) { HillManager._toggle = true; Thread.Sleep(HillManager.WAIT_TIME_IN_MILISECONDS); while (true) { HillManager.runAutomation(hill); HillManager.checkToggle(); } }
static void Main(string[] args) { HillManager.runHill(); }