コード例 #1
0
        //private SpriteSheet _spriteSheet;

        public StarshipP2P(string craftDirectory, DVector2 position, DVector2 velocity, double payloadMass = 0, double propellantMass = 1500000)
            : base(craftDirectory, position, velocity, payloadMass, propellantMass, null)
        {
            StageOffset = new DVector2(0, 0);

            Fins    = new Fin[2];
            Fins[0] = new Fin(this, new DVector2(-1.2, -18.0), new DVector2(2.5, 5), 0, "Textures/Spacecrafts/ITS/Canard2.png", 1.5);
            Fins[1] = new Fin(this, new DVector2(2.0, 17.2), new DVector2(5.86, 13.0), -Math.PI / 6, "Textures/Spacecrafts/ITS/Fin.png", 3);

            Engines = new IEngine[9];
            for (int i = 0; i < 3; i++)
            {
                double engineOffsetX = (i - 4.0) / 4.0;
                var    offset        = new DVector2(engineOffsetX * Width * 0.2, Height * 0.4);
                Engines[i] = new RaptorSL360(i, this, offset);
            }

            for (int i = 3; i < 6; i++)
            {
                double engineOffsetX = (i - 4.0) / 4.0;
                var    offset        = new DVector2(engineOffsetX * Width * 0.2, Height * 0.4);
                Engines[i] = new RaptorSL300(i, this, offset);
            }

            for (int i = 6; i < 9; i++)
            {
                double engineOffsetX = (i - 4.0) / 4.0;
                var    offset        = new DVector2(engineOffsetX * Width * 0.2, Height * 0.4);
                Engines[i] = new RaptorSL360(i, this, offset);
            }

            //_spriteSheet = new SpriteSheet("Textures/Spacecrafts/Its/scaledShip.png", 12, 12);

            string texturePath = "Its/Starship.png";
            string fullPath    = Path.Combine("Textures/Spacecrafts", texturePath);

            this.Texture = new Bitmap(fullPath);

            this.payloadMass = payloadMass;
        }
コード例 #2
0
        //private SpriteSheet _spriteSheet;

        public SuperHeavy(string craftDirectory, DVector2 position, DVector2 velocity, double propellantMass = 3300000, double dryMass = 230000, int engineCount = 28, int thrust1 = 210, int thrust2 = 300)
            : base(craftDirectory, position, velocity, 0, propellantMass, "Its/SuperHeavy.png")
        {
            StageOffset = new DVector2(0, 59.0);

            double finOffset = -27.0;

            _gridFins = new[]
            {
                new SSGridFin(this, new DVector2(4.0, finOffset), true),
                new SSGridFin(this, new DVector2(-4.0, finOffset), false)
            };

            Engines = new IEngine[engineCount];
            int nGimbal = 7, nFixed = 24;

            switch (engineCount)
            {
            case 28:
                nGimbal = 8;
                nFixed  = 20;
                break;
            }

            for (int i = 0; i < nGimbal; i++)
            {
                double theta         = Math.PI / 2.0 + (Math.PI * i) / 3.5;
                double engineOffsetX = Math.Cos(theta);
                var    offset        = new DVector2(engineOffsetX * Width * 0.2, Height * 0.4);
                switch (thrust1)
                {
                case 210:
                    Engines[i] = new RaptorSL300(i, this, offset);
                    break;

                case 250:
                    Engines[i] = new RaptorSL360(i, this, offset);
                    break;

                case 300:
                    Engines[i] = new RaptorSL430(i, this, offset);
                    break;

                default:
                    Engines[i] = new RaptorSL2019(i, this, offset);
                    break;
                }
            }

            if (nFixed == 20)
            {
                for (int i = 0; i < nFixed; i++)
                {
                    double theta         = Math.PI / 2.0 + (Math.PI * i) / 6.0;
                    double engineOffsetX = Math.Cos(theta);
                    var    offset        = new DVector2(engineOffsetX * Width * 0.35, Height * 0.4);

                    Engines[i + 8] = new RaptorSL430(i + 8, this, offset);
                }
            }
            else
            {
                if (engineCount >= 13)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        double theta         = Math.PI / 2.0 + (Math.PI * i) / 10.0;
                        double engineOffsetX = Math.Cos(theta);
                        var    offset        = new DVector2(engineOffsetX * Width * 0.3, Height * 0.4);

                        switch (thrust2)
                        {
                        case 250:
                            Engines[i + 7] = new RaptorSL360(i + 7, this, offset);
                            break;

                        case 300:
                            Engines[i + 7] = new RaptorSL430(i + 7, this, offset);
                            break;

                        default:
                            Engines[i + 7] = new RaptorSL2019(i + 7, this, offset);
                            break;
                        }
                    }
                }

                if (engineCount >= 19)
                {
                    for (int i = 6; i < 12; i++)
                    {
                        double theta         = Math.PI / 2.0 + (Math.PI * i) / 6.0;
                        double engineOffsetX = Math.Cos(theta);
                        var    offset        = new DVector2(engineOffsetX * Width * 0.3, Height * 0.4);

                        switch (thrust2)
                        {
                        case 250:
                            Engines[i + 7] = new RaptorSL360(i + 7, this, offset);
                            break;

                        case 300:
                            Engines[i + 7] = new RaptorSL430(i + 7, this, offset);
                            break;

                        default:
                            Engines[i + 7] = new RaptorSL2019(i + 7, this, offset);
                            break;
                        }
                    }
                }

                if (engineCount >= 25)
                {
                    if (engineCount >= 31)
                    {
                        for (int i = 0; i < 12; i++)
                        {
                            double theta         = Math.PI / 2.0 + (Math.PI * i) / 6.0;
                            double engineOffsetX = Math.Cos(theta);
                            var    offset        = new DVector2(engineOffsetX * Width * 0.35, Height * 0.4);

                            switch (thrust2)
                            {
                            case 250:
                                Engines[i + 19] = new RaptorSL360(i + 19, this, offset);
                                break;

                            case 300:
                                Engines[i + 19] = new RaptorSL430(i + 19, this, offset);
                                break;

                            default:
                                Engines[i + 19] = new RaptorSL2019(i + 19, this, offset);
                                break;
                            }
                        }

                        if (engineCount >= 37)
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                double theta         = Math.PI / 2.0 + (Math.PI * i) / 3.0;
                                double engineOffsetX = Math.Cos(theta);
                                var    offset        = new DVector2(engineOffsetX * Width * 0.4, Height * 0.4);

                                switch (thrust2)
                                {
                                case 250:
                                    Engines[i + 31] = new RaptorSL360(i + 31, this, offset);
                                    break;

                                case 300:
                                    Engines[i + 31] = new RaptorSL430(i + 31, this, offset);
                                    break;

                                default:
                                    Engines[i + 31] = new RaptorSL2019(i + 31, this, offset);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < 6; i++)
                        {
                            double theta         = Math.PI / 2.0 + (Math.PI * i) / 3.0;
                            double engineOffsetX = Math.Cos(theta);
                            var    offset        = new DVector2(engineOffsetX * Width * 0.35, Height * 0.4);

                            switch (thrust1)
                            {
                            case 250:
                                Engines[i + 19] = new RaptorSL360(i + 19, this, offset);
                                break;

                            case 300:
                                Engines[i + 19] = new RaptorSL430(i + 19, this, offset);
                                break;

                            default:
                                Engines[i + 19] = new RaptorSL2019(i + 19, this, offset);
                                break;
                            }
                        }
                    }
                }
            }

            //_spriteSheet = new SpriteSheet("Textures/Spacecraft/Its/booster.png", 4, 12);

            string texturePath = "Its/SuperHeavy.png";
            string fullPath    = Path.Combine("Textures/Spacecrafts", texturePath);

            this.Texture = new Bitmap(fullPath);
            _dryMass     = dryMass;
        }