コード例 #1
0
        /// <summary>
        /// i.e. won't detect negative edge or holds
        /// </summary>
        /// <param name="inputHistory"></param>
        /// <param name="motionInput"></param>
        /// <returns></returns>
        public static bool InterpretNormalAttackInput(InputHistory inputHistory, AttackMotionInput motionInput)
        {
            InputHistoryEntry    entry   = inputHistory.GetEntry(0);
            IList <ButtonStatus> buttons = entry.buttons;

            ButtonStatus[] reference = motionInput.buttons;

            for (int i = 0; i < buttons.Count; i++)
            {
                ButtonStatus currStatus = buttons[i];
                if (reference[i] == ButtonStatus.Down &&
                    currStatus == ButtonStatus.Down)
                {
                    // Down match
                }
                else if (reference[i] == ButtonStatus.Up)
                {
                    // Up ignored
                }
                else
                {
                    // mismatch!
                    // TODO: might lead to strange behavior currently. i.e. 632AB might not give nothing instead of A DP
                    return(false);
                }
            }

            return(InterpretMotionInput(inputHistory, motionInput));
        }
コード例 #2
0
        /// <summary>
        /// i.e. won't detect negative edge
        /// Great for detecting FD, not so great for detecting throw
        /// </summary>
        /// <param name="inputHistory"></param>
        /// <param name="motionInput"></param>
        /// <returns></returns>
        public static bool InterpretHoldButtonCombo(InputHistory inputHistory, AttackMotionInput motionInput)
        {
            int index       = 0;
            int totalFrames = 0;

            InputHistoryEntry    entry   = null;
            IList <ButtonStatus> buttons = null;

            ButtonStatus[] reference = motionInput.buttons;

            bool noMatchesFound = true; // has the input history matched a button combo yet?

            while (noMatchesFound)
            {
                if (index >= inputHistory.GetSize())
                {
                    return(false);
                }

                entry   = inputHistory.GetEntry(index);
                buttons = entry.buttons;

                bool noMismatch = true;

                for (int i = 0; i < buttons.Count; i++)
                {
                    ButtonStatus currStatus = buttons[i];
                    if (reference[i] == ButtonStatus.Down &&
                        (currStatus == ButtonStatus.Down || currStatus == ButtonStatus.Hold))
                    {
                        // held[i] = true;
                    }
                    else if (reference[i] == ButtonStatus.Up)
                    {
                        // Up ignored
                    }
                    else
                    {
                        // mismatch!
                        // TODO: might lead to strange behavior currently. i.e. 632AB might not give nothing instead of A DP
                        noMismatch = false;
                    }
                }
                if (index > 0)
                {
                    // i.e. first input has running frames since last input.
                    // Only factor in if motion input is longer than 1 input (ie. 46A)
                    totalFrames += inputHistory.GetEntry(index - 1).runningFrames;
                    if (totalFrames > motionInput.frameLimit)
                    {
                        return(false);
                    }
                }

                if (noMismatch)
                {
                    return(InterpretMotionInput(inputHistory, motionInput));
                }

                index++;
            }
            return(false);
        }
コード例 #3
0
        /// <summary>
        /// i.e. won't detect negative edge
        /// Great for detecting FD, not so great for detecting throw
        /// </summary>
        /// <param name="inputHistory"></param>
        /// <param name="motionInput"></param>
        /// <returns></returns>
        public static bool InterpretTapButtonCombo(InputHistory inputHistory, AttackMotionInput motionInput)
        {
            int index       = 0;
            int totalFrames = 0;

            InputHistoryEntry    entry   = null;
            IList <ButtonStatus> buttons = null;

            ButtonStatus[] reference   = motionInput.buttons;
            int[]          frameLimits = new int[reference.Length];

            bool noMatchesFound = true; // has the input history matched a button combo yet?

            while (noMatchesFound)
            {
                if (index >= inputHistory.GetSize())
                {
                    return(false);
                }

                entry   = inputHistory.GetEntry(index);
                buttons = entry.buttons;

                for (int i = 0; i < buttons.Count; i++)
                {
                    ButtonStatus currStatus = buttons[i];
                    if (reference[i] == ButtonStatus.Down)
                    {
                        if (currStatus == ButtonStatus.Down)
                        {
                            frameLimits[i] = motionInput.frameLimit + 1;
                        }
                        else
                        {
                            // ignore everything else
                        }
                    }
                    else
                    {
                        // reference up doesn't affect button combo
                        frameLimits[i] = 100; // indicate safe state
                    }
                }
                if (index > 0)
                {
                    // i.e. first input has running frames since last input.
                    // Only factor in if motion input is longer than 1 input (ie. 46A)
                    totalFrames += inputHistory.GetEntry(index - 1).runningFrames;
                    if (totalFrames > motionInput.frameLimit)
                    {
                        return(false);
                    }
                }

                bool buttonComboDetected = true;
                for (int i = 0; i < frameLimits.Length; i++)
                {
                    if (frameLimits[i] <= 0)
                    {
                        buttonComboDetected = false;
                    }
                    frameLimits[i] = frameLimits[i] - 1;
                }
                if (buttonComboDetected)
                {
                    return(InterpretMotionInput(inputHistory, motionInput));
                }

                index++;
            }
            return(false);
        }
コード例 #4
0
        private void initMotionInputs()
        {
            IList <string> list236B = new List <string> ();

            list236B.Add("236");
            list236B.Add("2365");
            list236B.Add("2369");
            S236B = new AttackMotionInput(list236B, "B", Time236);

            IList <string> list66 = new List <string> ();

            list66.Add("656");
            list66.Add("956");
            list66.Add("9856");
            list66.Add("9656");
            M66 = new MotionInput(list66, Time66);

            IList <string> list44 = new List <string> ();

            list44.Add("454");
            list44.Add("754");
            list44.Add("7854");
            list44.Add("7454");
            M44 = new MotionInput(list44, Time66);

            IList <string> list4 = new List <string> ();

            list4.Add("4");
            M4 = new MotionInput(list4, 0);
            IList <string> list6 = new List <string> ();

            list6.Add("6");
            M6 = new MotionInput(list6, 0);
            IList <string> listJump = new List <string> ();

            listJump.Add("8");
            listJump.Add("7");
            listJump.Add("9");
            MJump = new MotionInput(listJump, 0);

            IList <string> list5A = new List <string> ();

            list5A.Add("5");
            list5A.Add("6");
            list5A.Add("4");
            list5A.Add("1");
            list5A.Add("2");
            list5A.Add("3");
            list5A.Add("7");
            list5A.Add("8");
            list5A.Add("9");
            N5A = new AttackMotionInput(list5A, "A", 0);

            IList <string> list5B = new List <string> ();

            list5B.Add("5");
            list5B.Add("6");
            list5B.Add("4");
            list5B.Add("1");
            list5B.Add("2");
            list5B.Add("3");
            list5B.Add("7");
            list5B.Add("8");
            list5B.Add("9");
            N5B = new AttackMotionInput(list5B, "B", 0);

            IList <string> list5C = new List <string> ();

            list5C.Add("5");
            list5C.Add("6");
            list5C.Add("4");
            list5C.Add("1");
            list5C.Add("2");
            list5C.Add("3");
            list5C.Add("7");
            list5C.Add("8");
            list5C.Add("9");
            N5C = new AttackMotionInput(list5C, "C", 0);

            IList <string> listForwardThrow = new List <string> ();

            listForwardThrow.Add("6");
            ForwardThrow = new AttackMotionInput(listForwardThrow, "AD", 2);

            IList <string> listBackwardThrow = new List <string> ();

            listBackwardThrow.Add("4");
            BackwardThrow = new AttackMotionInput(listBackwardThrow, "AD", 2);

            IList <string> listRC = new List <string> ();

            listRC.Add("5");
            listRC.Add("6");
            listRC.Add("4");
            listRC.Add("1");
            listRC.Add("2");
            listRC.Add("3");
            listRC.Add("7");
            listRC.Add("8");
            listRC.Add("9");
            RC = new AttackMotionInput(listRC, "ABD", 3);
        }