Advertisement
Guest User

Untitled

a guest
May 11th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. public class Bizzycola : Person
  2. {
  3.     Timer foodTimer;
  4.     Timer sleepTimer;
  5.     bool sleeping = false;
  6.    
  7.     public static void Main(string[] args)
  8.     {
  9.         foodTimer = new Timer(15000); //eat every 15 seconds, very important to maintain ability to bother gamax
  10.         foodTimer.Elapsed += delegate{ if(!sleeping){base.Eat(base.FindNearestFood());} };
  11.         foodTimer.Start();
  12.        
  13.         sleepTimer = new Timer(120000); //sleep every few minutes, also important, Bizzycola is a rather lazy extension of the original person
  14.         sleepTimer.Elapsed += delegate{ sleeping = true; Thread.CurrentThread.Sleep(300000); sleeping = false; annoy(People.FindFromName("gamax92"); };
  15.         sleepTimer.Start();
  16.        
  17.         annoy(People.FindFromName("gamax92");
  18.     }
  19.    
  20.     public static void annoy(Person person)
  21.     {
  22.         while(!sleeping)
  23.         {
  24.             person.bother();
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement