Exemplo n.º 1
0
        public object Clone()
        {
            ReplayFrame frame = new ReplayFrame();

            frame.TimeDiff              = TimeDiff;
            frame.Time                  = Time;
            frame.X                     = X;
            frame.Y                     = Y;
            frame.Keys                  = Keys;
            frame.keyCounter            = keyCounter;
            frame.combo                 = combo;
            frame.travelledDistance     = travelledDistance;
            frame.travelledDistanceDiff = travelledDistanceDiff;
            frame.speed                 = speed;
            frame.acceleration          = acceleration;
            return(frame);
        }
Exemplo n.º 2
0
        private void calculateCursorSpeed()
        {
            double distance = 0;

            times = ReplayFrames.Where(x => x.TimeDiff > 0).ToList();

            if (!ReferenceEquals(times, null) && times.Count > 0)
            {
                times[0].travelledDistance     = distance;
                times[0].travelledDistanceDiff = 0;
                for (int i = 0; i < times.Count - 1; ++i)
                {
                    ReplayFrame from = times[i], to = times[i + 1];
                    double      newDist = Utils.dist(from.X, from.Y, to.X, to.Y);
                    distance                += newDist;
                    to.travelledDistance     = distance;
                    to.travelledDistanceDiff = newDist;
                }

                times[0].speed = 0;
                for (int i = 0; i < times.Count - 1; ++i)
                {
                    ReplayFrame to = times[i + 1], current = times[i];

                    double V = (to.travelledDistance - current.travelledDistance) / (to.TimeDiff);
                    to.speed = V;
                }
                times.Last().speed = 0;

                times[0].acceleration = 0;
                for (int i = 0; i < times.Count - 1; ++i)
                {
                    ReplayFrame to = times[i + 1], current = times[i];

                    double A = (to.speed - current.speed) / (to.TimeDiff);
                    to.acceleration = A;
                }
                times.Last().acceleration = 0;
            }
        }