IEnumerator LoadDebris()
    {
        spaceCraft   = GameObject.Find("SpaceCraft");
        attribute    = spaceCraft.GetComponent <attributeDefiner>();
        Loading.text = "Downloading Game Debris Data";
        yield return(new WaitForSeconds(1));

        string jsonURL  = @"https://worldwind.arc.nasa.gov/spacebirds/data/TLE.json";
        WWW    download = new WWW(jsonURL);

        while (!download.isDone)
        {
            Progress.fillAmount = download.progress;
            float prog = download.progress * 100;
            ProgressText.text = "" + (int)prog + "%";

            yield return(null);
        }

        yield return(download);

        List <Debris> debrisData = JsonConvert.DeserializeObject <List <Debris> >(download.text);

        Loading.text = "Loading Game Debris.";


        foreach (var item in debrisData)
        {
            if (item.OBJECT_TYPE == "DEBRIS")
            {
                Tle        tle    = new Tle(item.OBJECT_ID, item.TLE_LINE1, item.TLE_LINE2);
                Satellite  sat    = new Satellite(tle);
                List <Eci> coords = new List <Eci>();

                Eci eci = sat.PositionEci(900);

                Vector3 pos = new Vector3((float)eci.Position.X, (float)eci.Position.Y, (float)eci.Position.Z);
                Debug.Log(pos);
                float decider = Random.value;

                if (decider <= 0.33)
                {
                    DebrisGenerator(bolt, pos);
                }
                else if (decider > 0.33 && decider <= 0.66)
                {
                    DebrisGenerator(nut, pos);
                }
                else
                {
                    DebrisGenerator(sheet, pos);
                }
            }
        }
        yield return(new WaitForSeconds(1));

        LoadingScreen.SetActive(false);
        attribute.IsLoading = false;
    }
예제 #2
0
 void Start()
 {
     spaceCraft       = GameObject.Find("SpaceCraft");
     spaceCraftAnchor = GameObject.Find("SpaceCraftAnchor");
     rbdAnchor        = spaceCraftAnchor.GetComponent <Rigidbody>();
     attribute        = spaceCraft.GetComponent <attributeDefiner>();
     updateMethod     = spaceCraft.GetComponent <updateMethods>();
 }
예제 #3
0
 void Start()
 {
     line             = gameObject.GetComponent <LineRenderer>();
     line.enabled     = false;
     Cursor.lockState = CursorLockMode.Locked;
     attribute        = Craft.GetComponent <attributeDefiner>();
     updateMethod     = Craft.GetComponent <updateMethods>();
 }
예제 #4
0
 void Start()
 {
     spaceCraft = GameObject.Find("SpaceCraft");
     attribute  = spaceCraft.GetComponent <attributeDefiner>();
 }
예제 #5
0
 void Start()
 {
     attribute = Craft.GetComponent <attributeDefiner>();
 }