示例#1
0
    // Use this for initialization
    void Awake()
    {
        //if( starData == null )
        //	starData = Resources.Load<TextAsset>("stars");

        DontDestroyOnLoad(this);

        if (starLoader == null)
        {
            starLoader = this;


            //m = GenerateStar();

            Debug.Log("Starting Load..");
            //StartCoroutine( readStars(Application.persistentDataPath + "/stars.csv") );
            StartCoroutine(LoadStarsFromBinary());
            //StartCoroutine( drawStars() );
            canvas = GameObject.Find("Canvas").GetComponent <Canvas>();

            target = gameObject;
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        Stars = LoadStars.Load();

        OrbitCamera.SetMode(CameraMode.Free);
        OrbitCamera.OrbitLocation(Stars[0]);
        GuiManager.SetStarFocus(Stars[0]);
    }
示例#3
0
    static void CreateStars()
    {
        Object[] starMeshes = Object.FindObjectsOfType(typeof(StarMesh));
        foreach (var starMesh in starMeshes)
        {
            DestroyImmediate((starMesh as StarMesh).gameObject);
        }

        Star[] stars = LoadStars.Load();

        float min = float.MaxValue;
        float max = float.MinValue;

        GetMinMaxAbsMag(stars, ref min, ref max);

        int maxStarsPerMesh = 15000;

        for (int i = 0; i < stars.Length; i += maxStarsPerMesh)
        {
            //GeneratePointMesh(stars, i, Mathf.Min(maxStarsPerMesh, stars.Length - i), min, max);
            GenerateMesh(stars, i, Mathf.Min(maxStarsPerMesh, stars.Length - i), min, max);
        }
    }