Esempio n. 1
0
 public void ChangeSpeed(object source, MyEventArgs arg)
 {
     if (arg.numb == Number && arg.type == GetType().Name)
     {
         if ((string)source == "MySpeedUpEvent")
         {
             speed = speed + (arg.k * 5);
             if (speed > maxspeed) speed = maxspeed;
         }
         if ((string)source == "MySpeedDownEvent")
         {
             speed = speed - (arg.k * 5);
             if (speed < 1) speed = 1;
         }
     }
 }
Esempio n. 2
0
 public void OnSpeedUpEvent(int k, string className, int num)
 {
     MyEventArgs arg = new MyEventArgs();
     if (SpeedUpEvent != null)
     {
         arg.type = className;
         arg.numb = num;
         arg.k = k;
         SpeedUpEvent(this, arg);
     }
 }