private void addFrame(double time, float?position = null, bool dashing = false)
        {
            var last = currentFrame;

            currentFrame = new CatchReplayFrame(time, position, dashing, last);
            Replay.Frames.Add(currentFrame);
        }
        private void addFrame(double time, float?position = null, bool dashing = false)
        {
            // todo: can be removed once FramedReplayInputHandler correctly handles rewinding before first frame.
            if (Replay.Frames.Count == 0)
            {
                Replay.Frames.Add(new CatchReplayFrame(time - 1, position, false, null));
            }

            var last = currentFrame;

            currentFrame = new CatchReplayFrame(time, position, dashing, last);
            Replay.Frames.Add(currentFrame);
        }
Ejemplo n.º 3
0
        public CatchReplayFrame(double time, float?position = null, bool dashing = false, CatchReplayFrame lastFrame = null)
            : base(time)
        {
            Position = position ?? -1;
            Dashing  = dashing;

            if (Dashing)
            {
                Actions.Add(CatchAction.Dash);
            }

            if (lastFrame != null)
            {
                if (Position > lastFrame.Position)
                {
                    lastFrame.Actions.Add(CatchAction.MoveRight);
                }
                else if (Position < lastFrame.Position)
                {
                    lastFrame.Actions.Add(CatchAction.MoveLeft);
                }
            }
        }