Exemple #1
0
        private void FireThrusterSprtFire(List <MyVector[]> thrusters, ThrusterKey key)
        {
            foreach (MyVector[] thruster in thrusters)
            {
                _ship.ApplyInternalForce(thruster[0], thruster[1] * _thrustForceMultiplier);

                MyVector offsetWorld = _ship.Rotation.GetRotatedVector(thruster[0], true);
                offsetWorld.Add(_ship.Position);

                MyVector forceWorld = _ship.Rotation.GetRotatedVector(thruster[1], true);

                DrawThrustRunning(offsetWorld, forceWorld, _thrusterColors[key]);
            }
        }
Exemple #2
0
        private void pctThrust_Click(object sender, EventArgs e)
        {
            if (sender == pctA)
            {
                _addThrusterTo = ThrusterKey.A;
            }
            else if (sender == pctS)
            {
                _addThrusterTo = ThrusterKey.S;
            }
            else if (sender == pctD)
            {
                _addThrusterTo = ThrusterKey.D;
            }
            else if (sender == pctW)
            {
                _addThrusterTo = ThrusterKey.W;
            }
            else if (sender == pctUp)
            {
                _addThrusterTo = ThrusterKey.Up;
            }
            else if (sender == pctDown)
            {
                _addThrusterTo = ThrusterKey.Down;
            }
            else if (sender == pctLeft)
            {
                _addThrusterTo = ThrusterKey.Left;
            }
            else if (sender == pctRight)
            {
                _addThrusterTo = ThrusterKey.Right;
            }
            else
            {
                throw new ApplicationException("Unknown Sender: " + sender.ToString());
            }

            SetState(GlobalState.AddingThruster);

            radThrusterCustom.Checked = true;
        }
Exemple #3
0
        private void FireThruster(ThrusterKey key)
        {
            switch (_thrustMode)
            {
            case ThrustMode.Standard:
                if (_thrustersStandard.ContainsKey(key))
                {
                    FireThrusterSprtFire(_thrustersStandard[key], key);
                }
                break;

            case ThrustMode.Custom:
                if (_thrustersCustom.ContainsKey(key))
                {
                    FireThrusterSprtFire(_thrustersCustom[key], key);
                }
                break;

            default:
                throw new ApplicationException("Unknown ThrustMode: " + _thrustMode);
            }
        }
Exemple #4
0
        private void ColorArrowKeysSprtSinglePictureBox(PictureBox pctBox, bool isPressed, ThrusterKey key)
        {
            Color  pressedColor;
            double alpha;

            if (isPressed)
            {
                pressedColor = SystemColors.ControlDark;
                alpha        = .5d;
            }
            else
            {
                pressedColor = SystemColors.Control;
                alpha        = .25d;
            }

            if (_thrustersCustom.ContainsKey(key))
            {
                pctBox.BackColor = UtilityGDI.AlphaBlend(_thrusterColors[key], pressedColor, alpha);
            }
            else
            {
                pctBox.BackColor = SystemColors.Control;
            }
        }
        private void FireThrusterSprtFire(List<MyVector[]> thrusters, ThrusterKey key)
        {

            foreach (MyVector[] thruster in thrusters)
            {
                _ship.ApplyInternalForce(thruster[0], thruster[1] * _thrustForceMultiplier);

                MyVector offsetWorld = _ship.Rotation.GetRotatedVector(thruster[0], true);
                offsetWorld.Add(_ship.Position);

                MyVector forceWorld = _ship.Rotation.GetRotatedVector(thruster[1], true);

                DrawThrustRunning(offsetWorld, forceWorld, _thrusterColors[key]);
            }

        }
        private void FireThruster(ThrusterKey key)
        {

            switch (_thrustMode)
            {
                case ThrustMode.Standard:
                    if (_thrustersStandard.ContainsKey(key))
                    {
                        FireThrusterSprtFire(_thrustersStandard[key], key);
                    }
                    break;

                case ThrustMode.Custom:
                    if (_thrustersCustom.ContainsKey(key))
                    {
                        FireThrusterSprtFire(_thrustersCustom[key], key);
                    }
                    break;

                default:
                    throw new ApplicationException("Unknown ThrustMode: " + _thrustMode);
            }

        }
        private void pctThrust_Click(object sender, EventArgs e)
        {

            if (sender == pctA)
            {
                _addThrusterTo = ThrusterKey.A;
            }
            else if (sender == pctS)
            {
                _addThrusterTo = ThrusterKey.S;
            }
            else if (sender == pctD)
            {
                _addThrusterTo = ThrusterKey.D;
            }
            else if (sender == pctW)
            {
                _addThrusterTo = ThrusterKey.W;
            }
            else if (sender == pctUp)
            {
                _addThrusterTo = ThrusterKey.Up;
            }
            else if (sender == pctDown)
            {
                _addThrusterTo = ThrusterKey.Down;
            }
            else if (sender == pctLeft)
            {
                _addThrusterTo = ThrusterKey.Left;
            }
            else if (sender == pctRight)
            {
                _addThrusterTo = ThrusterKey.Right;
            }
            else
            {
                throw new ApplicationException("Unknown Sender: " + sender.ToString());
            }

            SetState(GlobalState.AddingThruster);

            radThrusterCustom.Checked = true;

        }
        private void ColorArrowKeysSprtSinglePictureBox(PictureBox pctBox, bool isPressed, ThrusterKey key)
        {

            Color pressedColor;
            double alpha;

            if (isPressed)
            {
                pressedColor = SystemColors.ControlDark;
                alpha = .5d;
            }
            else
            {
                pressedColor = SystemColors.Control;
                alpha = .25d;
            }

            if (_thrustersCustom.ContainsKey(key))
            {
                pctBox.BackColor = UtilityGDI.AlphaBlend(_thrusterColors[key], pressedColor, alpha);
            }
            else
            {
                pctBox.BackColor = SystemColors.Control;
            }

        }