Exemplo n.º 1
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     mouseDownPoint = e.Location;
     IsMouseDown = true;
     if (CurrentAnimation == null || !(CurrentAnimation is Falling))
     {
         CurrentAnimation = new Falling(this);
     }
 }
Exemplo n.º 2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (CurrentAnimation == null)
     {
         CurrentAnimation = new Falling(this);
     }
     if (CurrentAnimation.Finished)
     {
         var animations = Assembly.GetExecutingAssembly().GetTypes().Where(t => string.Equals(t.Namespace, "scmpoo.animations.random"));
         var anim = animations.ElementAt(FormMain.RandomInst.Next(0, animations.Count()));
         CurrentAnimation = Activator.CreateInstance(anim, this) as Animation;
     }
     if (!CurrentAnimation.Started)
     {
         CurrentAnimation.Start();
         CurrentAnimation.Started = true;
     }
     int interval = CurrentAnimation.Tick();
     timer1.Interval = interval;
 }