Exemplo n.º 1
0
        private static void GetDesiredVector(out Vector3D unit, out double length, ChasePoint_GetForceArgs e, ChaseDirectionType direction)
        {
            switch (direction)
            {
            case ChaseDirectionType.Drag_Velocity_Along:
            case ChaseDirectionType.Drag_Velocity_AlongIfVelocityAway:
            case ChaseDirectionType.Drag_Velocity_AlongIfVelocityToward:
                unit   = e.VelocityAlongUnit;
                length = e.VelocityAlongLength;
                break;

            case ChaseDirectionType.Attract_Direction:
                unit   = e.DirectionUnit;
                length = e.DirectionLength;
                break;

            case ChaseDirectionType.Drag_Velocity_Any:
                unit   = e.VelocityUnit;
                length = e.VelocityLength;
                break;

            case ChaseDirectionType.Drag_Velocity_Orth:
                unit   = e.VelocityOrthUnit;
                length = e.VelocityOrthLength;
                break;

            default:
                throw new ApplicationException("Unknown DirectionType: " + direction.ToString());
            }
        }
Exemplo n.º 2
0
        private static void SetDirectionInCombobox(ComboBox combo, ChaseDirectionType direction)
        {
            string searchFor = null;
            switch (direction)
            {
                case ChaseDirectionType.Attract_Direction:
                    searchFor = DIRECTION_DIRECTION;
                    break;

                case ChaseDirectionType.Drag_Velocity_Along:
                    searchFor = DIRECTION_VELOCITY_ALONG;
                    break;

                case ChaseDirectionType.Drag_Velocity_AlongIfVelocityAway:
                    searchFor = DIRECTION_VELOCITY_ALONGIFAWAY;
                    break;

                case ChaseDirectionType.Drag_Velocity_AlongIfVelocityToward:
                    searchFor = DIRECTION_VELOCITY_ALONGIFTOWARD;
                    break;

                case ChaseDirectionType.Drag_Velocity_Any:
                    searchFor = DIRECTION_VELOCITY_ANY;
                    break;

                case ChaseDirectionType.Drag_Velocity_Orth:
                    searchFor = DIRECTION_VELOCITY_ORTH;
                    break;

                default:
                    throw new ApplicationException("Unknown ChasePoint_DirectionType: " + direction.ToString());
            }

            bool foundIt = false;

            for (int cntr = 0; cntr < combo.Items.Count; cntr++)
            {
                TextBlock item = (TextBlock)combo.Items[cntr];

                if (item.Text == searchFor)
                {
                    combo.SelectedIndex = cntr;
                    foundIt = true;
                    break;
                }
            }

            if (!foundIt)
            {
                throw new ApplicationException("Didn't find the direction in the combo box items: " + direction.ToString());
            }
        }
        private static void GetDesiredVector(out Vector3D unit, out double length, ChaseOrientation_GetTorqueArgs e, ChaseDirectionType direction)
        {
            switch (direction)
            {
                case ChaseDirectionType.Drag_Velocity_Along:
                case ChaseDirectionType.Drag_Velocity_AlongIfVelocityAway:
                case ChaseDirectionType.Drag_Velocity_AlongIfVelocityToward:
                    unit = e.AngVelocityAlongUnit;
                    length = e.AngVelocityAlongLength;
                    break;

                case ChaseDirectionType.Attract_Direction:
                    unit = e.Rotation.Axis;
                    length = e.Rotation.Angle;
                    break;

                case ChaseDirectionType.Drag_Velocity_Any:
                    unit = e.AngVelocityUnit;
                    length = e.AngVelocityLength;
                    break;

                case ChaseDirectionType.Drag_Velocity_Orth:
                    unit = e.AngVelocityOrthUnit;
                    length = e.AngVelocityOrthLength;
                    break;

                default:
                    throw new ApplicationException("Unknown DirectionType: " + direction.ToString());
            }
        }
Exemplo n.º 4
0
        private static void SetDirectionInCombobox(ComboBox combo, ChaseDirectionType direction)
        {
            string searchFor = null;

            switch (direction)
            {
            case ChaseDirectionType.Attract_Direction:
                searchFor = DIRECTION_DIRECTION;
                break;

            case ChaseDirectionType.Drag_Velocity_Along:
                searchFor = DIRECTION_VELOCITY_ALONG;
                break;

            case ChaseDirectionType.Drag_Velocity_AlongIfVelocityAway:
                searchFor = DIRECTION_VELOCITY_ALONGIFAWAY;
                break;

            case ChaseDirectionType.Drag_Velocity_AlongIfVelocityToward:
                searchFor = DIRECTION_VELOCITY_ALONGIFTOWARD;
                break;

            case ChaseDirectionType.Drag_Velocity_Any:
                searchFor = DIRECTION_VELOCITY_ANY;
                break;

            case ChaseDirectionType.Drag_Velocity_Orth:
                searchFor = DIRECTION_VELOCITY_ORTH;
                break;

            default:
                throw new ApplicationException("Unknown ChasePoint_DirectionType: " + direction.ToString());
            }

            bool foundIt = false;

            for (int cntr = 0; cntr < combo.Items.Count; cntr++)
            {
                TextBlock item = (TextBlock)combo.Items[cntr];

                if (item.Text == searchFor)
                {
                    combo.SelectedIndex = cntr;
                    foundIt             = true;
                    break;
                }
            }

            if (!foundIt)
            {
                throw new ApplicationException("Didn't find the direction in the combo box items: " + direction.ToString());
            }
        }