wingman007

SnakeOOPFinal2b_Timer

Oct 28th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SnakeOOP2b
  8. {
  9.     public delegate void TickEventHandler(object sender, EventArgs e);
  10.     class Timer
  11.     {
  12.         public event TickEventHandler Tick;
  13.  
  14.         private void OnTick(EventArgs e)
  15.         {
  16.             if (Tick != null)
  17.             {
  18.                 Tick(this, e);
  19.             }
  20.         }
  21.  
  22.         public void Start()
  23.         {
  24.             while(true)
  25.             {
  26.                 OnTick(EventArgs.Empty);
  27.                 System.Threading.Thread.Sleep(100);
  28.             }
  29.         }
  30.     }
  31. }
Add Comment
Please, Sign In to add comment