コード例 #1
0
        public MotionManager Motion(IMotion motion)
        {
            motion.Init(this);

            if (currentMotion == null)
            {
                currentMotion = motion;
                currentMotion.Start();
            }

            motion.OnComplete += () =>
            {
                if (motions.IndexOf(currentMotion) == motions.Count - 1)
                {
                    Completed = true;
                    if (completed != null)
                    {
                        completed();
                    }
                }
                else
                {
                    currentMotion = motions[motions.IndexOf(currentMotion) + 1];
                    currentMotion.Start();
                }
            };
            motions.Add(motion);
            return(this);
        }
コード例 #2
0
 public void Restart()
 {
     CurrentPosition = new PointF(positionX, positionY);
     foreach (var motion in motions)
     {
         motion.Init(this);
     }
     Completed     = false;
     currentMotion = motions[0];
     currentMotion.Start();
 }