Ejemplo n.º 1
0
        public static void SetTimer(Player player)
        {
            // Create a timer with a two second interval.

            Timer12  ti      = new Timer12(0, 05);
            Commands command = new Commands();

            aTimer = new System.Timers.Timer(1000);
            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed  += (sender, e) => OnTimedEvent(sender, e, ti, command, player);;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;
        }
Ejemplo n.º 2
0
 private static void OnTimedEvent(Object source, ElapsedEventArgs e, Timer12 ti, Commands cmd, Player player)
 {
     ti.CountDown();
     if (ti.TimeUp)
     {
         aTimer.Stop();
         cmd.GameOverMan(player, "\n**********************************\n\nYou are out of Time\n GAME OVER\n\n**********************************");
     }
     else
     {
         Console.Title  = Console.Title.Remove(16);
         Console.Title += $"? -- Time {ti.GetTime()}";
     }
 }