Example #1
0
 private void Generate()
 {
     if (GameManager.Instance.enableNebulas)
     {
         for (var i = 0; i < nebulas.Length; i++)
         {
             nebulas[i]          = new SavedNebula();
             nebulas[i].position = position * GameManager.Instance.chunkSize + new Vector3(
                 Random.Range(0, GameManager.Instance.chunkSize),
                 Random.Range(0, GameManager.Instance.chunkSize),
                 Random.Range(0, GameManager.Instance.chunkSize));
             nebulas[i].color = Random.value;
         }
     }
     if (GameManager.Instance.enableAsteroids)
     {
         for (var i = 0; i < asteroids.Length; i++)
         {
             asteroids[i]          = new SavedAsteroid();
             asteroids[i].position = position * GameManager.Instance.chunkSize +
                                     new Vector3(Random.Range(0, GameManager.Instance.chunkSize),
                                                 Random.Range(0, GameManager.Instance.chunkSize),
                                                 Random.Range(0, GameManager.Instance.chunkSize));
             asteroids[i].rotation = Random.rotation;
             asteroids[i].guid     = GameManager.Instance.asteroidIDs[Random.Range(0, GameManager.Instance.asteroidIDs.Count - 1)];
         }
     }
 }
Example #2
0
 public void Init(Vector3 position, Vector3[] nebulaPositions, float[] nebulaColors)
 {
     this.position = position;
     for (int i = 0; i < nebulaPositions.Length; i++)
     {
         nebulas[i]          = new SavedNebula();
         nebulas[i].position = nebulaPositions[i];
         nebulas[i].color    = nebulaColors[i];
     }
 }