Пример #1
0
 void Awake()
 {
     Util.rocketHolder = this;
     ri           = new RocketInfo(r1, true, "RANDOM", 0);
     purchased    = new bool[400];
     purchased[1] = true;
 }
Пример #2
0
 private void Awake()
 {
     EventManager.StartThrust += EnableGravity;
     rb = GetComponent <Rigidbody>();
     ri = GetComponent <RocketInfo>();
     //RocketInfo.instance.centerOfGravityPos.localPosition = CalcCenterOfGravity;
 }
Пример #3
0
 private void Awake()
 {
     rb = GetComponent <Rigidbody>();
     EventManager.StartThrust += StartThrust;
     EventManager.StartRamp   += StartRamp;
     ri        = GetComponent <RocketInfo>();
     thrustPos = ri.thrustPos;
 }
Пример #4
0
    public void setRocket()
    {
        setClosestRocket();
        if (selectedRocket > 0)
        {
            rocket1.SetActive(true);
            rocket1.transform.localPosition = new Vector3((selectedRocket - 2) * rocketSep, 0, 0);
            rocket1.GetComponent <ShowcaseRocket>().setup(Util.rocketHolder.getRocket(selectedRocket - 1));
        }
        else
        {
            rocket1.SetActive(false);
        }

        ri = Util.rocketHolder.getRocket(selectedRocket);
        rocket2.transform.localPosition = new Vector3((selectedRocket - 1) * rocketSep, 0, 0);
        rocket2.GetComponent <ShowcaseRocket>().setup(ri);
        rocketName.text = ri.name;
        if (ri.purchased)
        {
            owned.SetActive(true);
            buyInfo.SetActive(false);
        }
        else
        {
            owned.SetActive(false);
            buyInfo.SetActive(true);
            cost.text = "" + ri.cost;
        }



        if (selectedRocket < rocketCount)
        {
            rocket3.SetActive(true);
            rocket3.transform.localPosition = new Vector3(selectedRocket * rocketSep, 0, 0);
            rocket3.GetComponent <ShowcaseRocket>().setup(Util.rocketHolder.getRocket(selectedRocket + 1));
        }
        else
        {
            rocket3.SetActive(false);
        }

        if (!dragging && selectedRocket == 30)
        {
            if (colorSwitcher == null && !Util.wm.gameActive && !Util.wm.dieScreen)
            {
                colorSwitcher = Instantiate(colorSwitcherPrefab);
            }
        }
        else
        {
            if (colorSwitcher != null)
            {
                Destroy(colorSwitcher);
            }
        }
    }
Пример #5
0
    internal RocketInfo GetInfo( )
    {
        var info = new RocketInfo()
        {
            Position        = transform.position,
            Rotation        = transform.rotation.eulerAngles,
            Velocity        = GetComponent <Rigidbody>().velocity,
            WeaponInfoIndex = _prefabIndex
        };

        return(info);
    }
Пример #6
0
        public MissionDataForm(LaunchInfo launchInfo, RocketInfo rocketInfo, LaunchpadInfo launchpadInfo)
        {
            _missionData   = launchInfo;
            _rocketInfo    = rocketInfo;
            _launchpadInfo = launchpadInfo;
            _imagesInMedia = _missionData.Links.Flickr.Original.Count;

            InitializeComponent();
            CenterToScreen();
            rocketDetailsButton.Select();
            ShowMediaControls(false);
            ShowRocketData();
            AppTips();
        }
Пример #7
0
        static void Main(string[] args)
        {
            var csvPath = Path.Combine(Environment.CurrentDirectory, $"rockets-{DateTime.Now.ToFileTime()}.csv");

            using (var streamWriter = new StreamWriter(csvPath))
            {
                using (var csvWriter = new CsvWriter(streamWriter, CultureInfo.InvariantCulture))
                {
                    var rockets = RocketInfo.GetRockets();
                    csvWriter.Context.RegisterClassMap <RocketInfoClassMap>();
                    csvWriter.WriteRecords(rockets);
                }
            }
        }
Пример #8
0
        private void MissionData(int missionNumber)
        {
            EnableControls(false);

            _missionPatchLink = _launchesData[missionNumber].Links.Patch.Large;
            var missionPatchImageLink = _launchesData[missionNumber].Links.Patch.Small;

            _missionName = _launchesData[missionNumber].Name;
            var missionDetails = _launchesData[missionNumber].Details;
            var vehiclesStatus = _launchesData[missionNumber].Upcoming;
            var launchStatus   = _launchesData[missionNumber].Success;

            if (string.IsNullOrWhiteSpace(missionPatchImageLink))
            {
                missionPatchImageLabel.Image = (Image)_resources.GetObject("$this.spacexLogo");
            }
            else
            {
                missionPatchImageLabel.Image = Task.Run(() => HttpUtil.StreamUrlToImageAndResize(missionPatchImageLink, 256, 256)).Result;
            }

            missionNameLabel.Text    = string.IsNullOrWhiteSpace(_missionName) ? "— No mission name —" : _missionName;
            missionDetailsLabel.Text = string.IsNullOrWhiteSpace(missionDetails) ? "— No mission details —" : missionDetails;

            _rocketInfo    = new RestClient($"{ApiUrl}/rockets/{_launchesData[missionNumber].RocketId}").Get <RocketInfo>(new RestRequest("/")).Data;
            _launchpadInfo = JObject.Parse(new RestClient($"{ApiUrl}/launchpads/{_launchesData[missionNumber].LaunchpadId}")
                                           .Get(new RestRequest("/")).Content).ToObject <LaunchpadInfo>();
            vehicleStatusLabel.Text = vehiclesStatus == true ? $"{_rocketInfo.Name} will be launched from {_launchpadInfo.Name}" : $"{_rocketInfo.Name} launched from {_launchpadInfo.Name}";

            switch (launchStatus)
            {
            case true:
                missionStatusLabel.ForeColor = Color.Green;
                missionStatusLabel.Text      = "SUCCESSFUL";
                break;

            case false:
                missionStatusLabel.ForeColor = Color.Red;
                missionStatusLabel.Text      = "FAILED";
                break;

            default:
                missionStatusLabel.ForeColor = Color.Blue;
                missionStatusLabel.Text      = $"Will be launched in {_launchesData[missionNumber].DateLocal}";
                break;
            }

            EnableControls(true);
        }
Пример #9
0
 public void setup(RocketInfo ri)
 {
     rocketInfo    = ri;
     rocket.sprite = rocketInfo.sprite;
     transform.SetParent(Util.scrollManager.scrollParent.transform);
     transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
     if (ri.nozzle)
     {
         nozzle.color = new Color(1f, 1f, 1f);
     }
     else
     {
         nozzle.color = new Color(1f, 1f, 1f, 0);
     }
 }
Пример #10
0
    public void setup(RocketInfo ri)
    {
        this.ri = ri;
        rocketRenderer.sprite = ri.sprite;
        if (ri.nozzle)
        {
            nozzleRenderer.color = new Color(1f, 1f, 1f);
        }
        else
        {
            nozzleRenderer.color = new Color(1f, 1f, 1f, 0);
        }

        if (ri.fire == FlameType.flame)
        {
            shockDiamondRenderer.color = new Color(1f, 1f, 1f, 0.4f);
        }
        else
        {
            shockDiamondRenderer.color = new Color(1f, 1f, 1f, 0);
        }

        if (!Util.wm.soundMuted)
        {
            switch (ri.sound)
            {
            case SoundType.rocket: rocketBGSource.clip = rocketBG;  break;

            case SoundType.none: rocketBGSource.clip = new AudioClip(); break;

            case SoundType.jet: rocketBGSource.clip = jet; break;

            case SoundType.drone: rocketBGSource.clip = drone; break;

            case SoundType.car: rocketBGSource.clip = car; break;

            case SoundType.gun: rocketBGSource.clip = gun; break;
            }
            rocketBGSource.Play();
            rocketStartSource.Play();
        }
        else
        {
            rocketBGSource.Stop();
            rocketStartSource.Stop();
        }
    }
    public void SelectDeltaIVRocket()
    {
        //Find the specific rocket info
        foreach (RocketInfo ri in rocketList)
        {
            if (ri.rocketName == "DeltaIV")
            {
                //Update menu text
                costText.text    = ri.costString;
                timeText.text    = ri.timeString;
                marscapText.text = ri.marscapString;
                leocapText.text  = ri.leocapString;

                selectRocket = ri;
            }
        }
    }
Пример #12
0
        private string GetTableWithRocketParameters(RocketInfo rocket)
        {
            var tableBuilder = new StringBuilder();

            tableBuilder.Append("```");
            tableBuilder.Append($"Diameter: {rocket.Diameter.Meters ?? 0} m".PadRight(FieldLength));
            tableBuilder.Append($"Launch cost: ${(rocket.CostPerLaunch ?? 0) / 1_000_000}M\r\n");
            tableBuilder.Append($"First flight: {rocket.FirstFlight:dd-MM-yyyy}".PadRight(FieldLength));
            tableBuilder.Append($"Success rate: {rocket.SuccessRate ?? 0} %\r\n");
            tableBuilder.Append($"Mass: {(int)((rocket.Mass.Kilograms ?? 0f) / 1000)} t".PadRight(FieldLength));
            tableBuilder.Append($"Height: {rocket.Height.Meters ?? 0} m\r\n");

            if (rocket.Engines.ThrustSeaLevel != null && rocket.Engines.ThrustToWeight.HasValue)
            {
                tableBuilder.Append($"Thrust: {(int)((rocket.Engines.ThrustSeaLevel.Kilonewtons ?? 0) * (rocket.Engines.Number ?? 1))} kN".PadRight(FieldLength));
                tableBuilder.Append($"TWR: {(int)rocket.Engines.ThrustToWeight.Value}\r\n");
            }

            tableBuilder.Append("\r\n");
            tableBuilder.Append(GetRocketPayload(rocket.PayloadWeights));
            tableBuilder.Append("```\r\n");

            return(tableBuilder.ToString());
        }
Пример #13
0
    public RocketInfo getRocket(int i)
    {
        switch (i)
        {
        case 0: if (Util.wm.alternate)
            {
                string oldName = ri.name;
                do
                {
                    ri = getRocket((int)Random.Range(1f, ScrollManager.rocketCount + 0.99f));
                }while (!ri.purchased || oldName.Equals(ri.name));
                ri.name           = "RANDOM";
                Util.wm.alternate = !Util.wm.alternate;
                return(ri);
            }
            else
            {
                return(ri);
            }

        // RocketInfo(Sprite spr, bool p, string n, int c, bool noz, bool fire)
        case 1:  return(new RocketInfo(r1, purchased[i], r1.name, 0));                                                //rocket

        case 2:  return(new RocketInfo(r2, purchased[i], r2.name, 100));                                              //f9

        case 3:  return(new RocketInfo(r3, purchased[i], r3.name, 550));                                              //shuttle

        case 4:  return(new RocketInfo(r4, purchased[i], r4.name, 200));                                              //soyuz

        case 5:  return(new RocketInfo(r5, purchased[i], r5.name, 270));                                              //proton

        case 6:  return(new RocketInfo(r6, purchased[i], r6.name, 500));                                              //SaturnV

        case 7:  return(new RocketInfo(r7, purchased[i], r7.name, 270));                                              //atlas 5

        case 8:  return(new RocketInfo(r8, purchased[i], r8.name, 400));                                              //ariane 4

        case 9:  return(new RocketInfo(r9, purchased[i], r9.name, 400));                                              //ariane 5

        case 10: return(new RocketInfo(r10, purchased[i], r10.name, 600));                                            //titan

        case 11: return(new RocketInfo(r11, purchased[i], r11.name, 400));                                            //n1

        case 12: return(new RocketInfo(r12, purchased[i], r12.name, 650));                                            //delta IV heavy

        case 13: return(new RocketInfo(r13, purchased[i], r13.name, 450));                                            //v2

        case 14: return(new RocketInfo(r14, purchased[i], r14.name, 700));                                            //SLS

        case 15: return(new RocketInfo(r15, purchased[i], r15.name, 1000));                                           //Apollo

        case 16: return(new RocketInfo(r16, purchased[i], r16.name, 500));                                            //tomahawk

        case 17: return(new RocketInfo(r17, purchased[i], r17.name, 450, false, FlameType.flame, SoundType.jet));     //fighter jet

        case 18: return(new RocketInfo(r18, purchased[i], r18.name, 500, false, FlameType.flame, SoundType.jet));     //Blackbird

        case 19: return(new RocketInfo(r19, purchased[i], r19.name, 500, false, FlameType.smoke, SoundType.jet));     //Concorde

        case 20: return(new RocketInfo(r20, purchased[i], r20.name, 1500, false, FlameType.none, SoundType.car));     //Lambo

        case 21: return(new RocketInfo(r21, purchased[i], r21.name, 1200, true, FlameType.scifi, SoundType.car));     //magic school bus

        case 22: return(new RocketInfo(r22, purchased[i], r22.name, 1100, false, FlameType.none, SoundType.car));     //chitty

        case 23: return(new RocketInfo(r23, purchased[i], r23.name, 1500, false, FlameType.none, SoundType.car));     //F1

        case 24: return(new RocketInfo(r24, purchased[i], r24.name, 1000, false, FlameType.none, SoundType.none));    //rocketpop

        case 25: return(new RocketInfo(r25, purchased[i], r25.name, 950, false, FlameType.none, SoundType.none));     //rocket n roll

        case 26: return(new RocketInfo(r26, purchased[i], r26.name, 800));                                            //keyrocket

        case 27: return(new RocketInfo(r27, purchased[i], r27.name, 1100, false, FlameType.none, SoundType.none));    //hot docket

        case 28: return(new RocketInfo(r28, purchased[i], r28.name, 650, false, FlameType.none, SoundType.none));     //paper

        case 29: return(new RocketInfo(r29, purchased[i], r29.name, 1200, false, FlameType.none, SoundType.none));    //myphone

        case 30: return(getCrayon(i));                                                                                //crayon

        case 31: return(new RocketInfo(r31, purchased[i], r31.name, 300, false, FlameType.scifi, SoundType.none));    //bottle

        case 32: return(new RocketInfo(r32, purchased[i], r32.name, 600, false, FlameType.bullet, SoundType.gun));    ///machine gun

        case 33: return(new RocketInfo(r33, purchased[i], r33.name, 1000));                                           //empire state

        case 34: return(new RocketInfo(r34, purchased[i], r34.name, 800));                                            //Eiffel rocket

        case 35: return(new RocketInfo(r35, purchased[i], r35.name, 1300));                                           //rocket khalifa

        case 36: return(new RocketInfo(r36, purchased[i], r36.name, 1000));                                           //Oriental Pearl

        case 37: return(new RocketInfo(r37, purchased[i], r37.name, 1000));                                           //Rocket Ben

        case 38: return(new RocketInfo(r38, purchased[i], r38.name, 1000, false, FlameType.flame, SoundType.rocket)); //raygun gothic

        case 39: return(new RocketInfo(r39, purchased[i], r39.name, 1200));                                           //THE MARTIAN

        case 40: return(new RocketInfo(r40, purchased[i], r40.name, 1500, false, FlameType.none, SoundType.none));    //mary poppins

        case 41: return(new RocketInfo(r41, purchased[i], r41.name, 1750, false, FlameType.none, SoundType.none));    //UP

        case 42: return(new RocketInfo(r42, purchased[i], r42.name, 1100, false, FlameType.smoke, SoundType.rocket)); //steel man

        case 43: return(new RocketInfo(r43, purchased[i], r43.name, 1000));                                           //apollo27

        case 44: return(new RocketInfo(r44, purchased[i], r44.name, 1750, false, FlameType.scifi, SoundType.rocket)); //pelican

        case 45: return(new RocketInfo(r45, purchased[i], r45.name, 1800, false, FlameType.scifi, SoundType.rocket)); //covenant carrier

        case 46: return(new RocketInfo(r46, purchased[i], r46.name, 1500, false, FlameType.scifi, SoundType.none));   //hogwarts

        case 47: return(new RocketInfo(r47, purchased[i], r47.name, 1800, false, FlameType.none, SoundType.jet));     //Cruise

        case 48: return(new RocketInfo(r48, purchased[i], r48.name, 1500, false, FlameType.none, SoundType.none));    //TITANIC

        case 49: return(new RocketInfo(r49, purchased[i], r49.name, 1200, false, FlameType.none, SoundType.drone));   //drone

        case 50: return(new RocketInfo(r50, purchased[i], r50.name, 400, false, FlameType.scifi, SoundType.rocket));  //star destroyer

        case 51: return(new RocketInfo(r51, purchased[i], r51.name, 0));

        case 52: return(new RocketInfo(r52, purchased[i], r52.name, 0));

        case 53: return(new RocketInfo(r53, purchased[i], r53.name, 0));

        case 54: return(new RocketInfo(r54, purchased[i], r54.name, 0));

        case 55: return(new RocketInfo(r55, purchased[i], r55.name, 0));

        case 56: return(new RocketInfo(r56, purchased[i], r56.name, 0));

        case 57: return(new RocketInfo(r57, purchased[i], r57.name, 0));

        case 58: return(new RocketInfo(r58, purchased[i], r58.name, 0));

        case 59: return(new RocketInfo(r59, purchased[i], r59.name, 0));
            //RocketInfo(Sprite spr, bool p, string n, int c, bool noz, bool f)
        }
        return(null);
    }
Пример #14
0
 private void Awake()
 {
     rb = GetComponent <Rigidbody>();
     ri = GetComponent <RocketInfo>();
 }