void Awake()
    {
        player  = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
        network = GameObject.FindGameObjectWithTag("Planet").GetComponent <TetherNetwork>();
        TerrainChunk.chunkPrefab = chunkPrefab;

        float foo = Time.time;

        shader = new RunShader(compute);
        shape  = new TerrainShape(biomesJSON)
        {
            settings = settings,
            shader   = densities
        };
        chunks     = new Dictionary <Vector3, TerrainChunk>();
        needUpdate = new Queue <TerrainChunk>();

        for (int x = -2; x <= 2; x++)
        {
            for (int y = -2; y <= 2; y++)
            {
                for (int z = -2; z <= 2; z++)
                {
                    CreateChunk(new Vector3(x * 39, y * 39, z * 39) + new Vector3(0, 975, 0));
                }
            }
        }

        Debug.Log(Time.realtimeSinceStartup - foo + " TIME");
    }
Пример #2
0
 public TetherNode(Tether tetherObject)
 {
     Debug.Log("New node");
     network           = GameObject.FindGameObjectWithTag("Planet").GetComponent <TetherNetwork>();
     this.tetherObject = tetherObject;
     if (tetherObject != null)
     {
         tetherPos = tetherObject.gameObject.transform.position;
     }
 }
Пример #3
0
 void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
     tetherNetwork    = GameObject.FindGameObjectWithTag("Planet").GetComponent <TetherNetwork>();
     body             = GetComponent <Rigidbody>();
     chunkPos         = new Vector3Int(0, 0, 0);
     deltaChunk       = new Vector3Int(0, 0, 0);
     camera           = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
     generator        = GameObject.FindGameObjectWithTag("Generator").GetComponent <TerrainGenerator>();
 }