Example #1
0
        //method is public for now inorder to manually trigger steps on iOS for testing.
        //Should be made private and removed from interface eventually
        public void StepTaken(bool startFromStat)
        {
            int stepIterations = (int)Math.Floor(totalStride / strideLength);

            float extraStep = totalStride % strideLength;

            var args = new PositionChangedHandlerEventArgs(realPosition.X, realPosition.Y);

            //StepCounter = 1;
            if (startFromStat == false)
            {
                for (int i = 0; i < stepIterations; i++)
                {
                    if (i == 0)
                    {
                        testStepTrigger(Heading);
                        args = new PositionChangedHandlerEventArgs(realPosition.X, realPosition.Y);
                    }
                    else
                    {
                        testStepTrigger(Heading);
                        args = new PositionChangedHandlerEventArgs(realPosition.X, realPosition.Y);
                    }
                    PositionChanged(this, args);
                }

                if (extraStep != 0)
                {
                    strideLength = extraStep;
                    testStepTrigger(Heading);
                    args = new PositionChangedHandlerEventArgs(realPosition.X, realPosition.Y);
                    PositionChanged(this, args);
                    strideLength = 12.0f;
                }
            }
            else
            {
                float[] headings = new float[headingQueue.Count];
                headingQueue.CopyTo(headings, 0);

                for (int j = 0; j < 3; j++)
                {
                    for (int i = 0; i < stepIterations; i++)
                    {
                        if (i == 0)
                        {
                            testStepTrigger(headings [4 + (j * 4)]);
                            args = new PositionChangedHandlerEventArgs(realPosition.X, realPosition.Y);
                        }
                        else
                        {
                            testStepTrigger(headings [4 + (j * 4)]);
                            args = new PositionChangedHandlerEventArgs(realPosition.X, realPosition.Y);
                        }
                        PositionChanged(this, args);
                    }
                    if (extraStep != 0)
                    {
                        strideLength = extraStep;
                        testStepTrigger(headings [4 + (j * 4)]);
                        args = new PositionChangedHandlerEventArgs(realPosition.X, realPosition.Y);
                        PositionChanged(this, args);
                        strideLength = 12.0f;
                    }
                }
            }
        }
Example #2
0
        //method is public for now inorder to manually trigger steps on iOS for testing. 
        //Should be made private and removed from interface eventually
        public void StepTaken(bool startFromStat)
        {
            int stepIterations = (int)Math.Floor (totalStride / strideLength);

            float extraStep = totalStride % strideLength;

            var args = new PositionChangedHandlerEventArgs (realPosition.X, realPosition.Y);
            //StepCounter = 1;
            if (startFromStat == false) {

                for (int i = 0; i < stepIterations; i++) {

                    if (i == 0) {
                        testStepTrigger (Heading);
                        args = new PositionChangedHandlerEventArgs (realPosition.X, realPosition.Y);
                    } else {
                        testStepTrigger (Heading);
                        args = new PositionChangedHandlerEventArgs (realPosition.X, realPosition.Y);
                    }
                    PositionChanged (this, args);
                }

                if (extraStep != 0) {
                    strideLength = extraStep;
                    testStepTrigger (Heading);
                    args = new PositionChangedHandlerEventArgs (realPosition.X, realPosition.Y);
                    PositionChanged (this, args);
                    strideLength = 12.0f;
                }
            } else {
                float[] headings = new float[headingQueue.Count];
                headingQueue.CopyTo (headings,0);

                for (int j = 0; j < 3; j++) {
                    for (int i = 0; i < stepIterations; i++) {

                        if (i == 0) {
                            testStepTrigger (headings [4+ (j*4)]);
                            args = new PositionChangedHandlerEventArgs (realPosition.X, realPosition.Y);
                        } else {
                            testStepTrigger (headings [4 + (j*4)]);
                            args = new PositionChangedHandlerEventArgs (realPosition.X, realPosition.Y);
                        }
                        PositionChanged (this, args);
                    }
                    if (extraStep != 0) {
                        strideLength = extraStep;
                        testStepTrigger (headings [4 + (j*4)]);
                        args = new PositionChangedHandlerEventArgs (realPosition.X, realPosition.Y);
                        PositionChanged (this, args);
                        strideLength = 12.0f;
                    }
                }

            }
        }