Exemple #1
0
        /// <summary>
        /// Configures the Transition modifier for this item.
        /// </summary>
        /// <param name="next">The next position; required to have an end point for the transition.</param>
        public void InitTransition(HandData next)
        {
            if (!HasTransitionModifier)
            {
                throw new Exception("Trying to init transition, but the SequenceItem is not specified to allow a transition.");
            }
            if (transition == null)
            {
                transition = new HashSet <PositionRecord>();
            }
            else
            {
                transition.Clear();
            }

            double[] diffs      = new double[22];
            double   iterations = 10.0;
            HandData needle     = new HandData();

            for (int i = 0; i < diffs.Length; i++)
            {
                diffs[i]        = (next[i].Radians - Position[i].Radians) / iterations;
                needle[i].Value = Position[i].Radians;
            }

            for (int i = 0; i < iterations; i++)
            {
                // Prepare the needle by making its values approach two's some more.
                needle.Add(diffs);
                // Check if this matches a position.
                List <PositionRecord> list = PositionParser.GetAllMatches(needle, 1.5);
                foreach (PositionRecord pr in list)
                {
                    if (transition.Add(pr))
                    {
                        Console.WriteLine("Found a transitional item: {0}", pr.Name);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Configures the Leniency modifier for this item.
        /// </summary>
        public void InitLeniency()
        {
            if (!HasLeniencyModifier)
            {
                throw new Exception("Trying to init leniency, but the SequenceItem is not specified to be lenient.");
            }
            if (leniency == null)
            {
                leniency = new HashSet <PositionRecord>();
            }
            else
            {
                leniency.Clear();
            }

            List <PositionRecord> list = PositionParser.GetAllMatches(Position);

            foreach (PositionRecord pr in list)
            {
                leniency.Add(pr);
            }
        }