Esempio n. 1
0
    void Awake()
    {
        pGrid    = GameObject.FindGameObjectWithTag("SceneManager").GetComponent <proceduralGrid> ();
        gridSize = new Vector2(pGrid.gridSizeX / 100, pGrid.gridSizeY / 100);

        Chunks = new GameObject("Chunks");

        for (int x = 0; x < gridSize.x; x++)
        {
            for (int y = 0; y < gridSize.y; y++)
            {
                GameObject currentChunk = Instantiate(chunkObject, new Vector2(0, 0), Quaternion.identity);
                currentChunk.GetComponent <chunkCtrl> ().chunkX = x * 100;
                currentChunk.GetComponent <chunkCtrl> ().chunkY = y * 100;
                currentChunk.name = "x:" + x * 100 + ",y:" + y * 100;

                currentChunk.transform.SetParent(Chunks.transform);
                pGrid.chunksObjects.Add(currentChunk);
            }
        }
    }
Esempio n. 2
0
 void Awake()
 {
     pGrid      = (proceduralGrid)FindObjectOfType(typeof(proceduralGrid));
     spawnPoint = new Vector3(pGrid.gridSizeX / 2, pGrid.gridSizeY, 0f);
 }
Esempio n. 3
0
 // Use this for initialization
 void Awake()
 {
     mesh           = GetComponent <MeshFilter>().mesh;
     backgroundMesh = background.GetComponent <MeshFilter>().mesh;
     pGrid          = (proceduralGrid)FindObjectOfType(typeof(proceduralGrid));
 }