Ejemplo n.º 1
0
    private void Awake()
    {
        // Initialize grid
        Vector3[,] grid = GridCreator.Create2DGrid(gridWidth, cellWidth, GridCreator.Axes.XZ);
        Vector3[] positionsForLineRenderer = new Vector3[gridWidth * gridWidth];
        gridPoints = new GridPoint[gridWidth, gridWidth];

        for (int i = 0; i < gridWidth; i++)
        {
            for (int j = 0; j < gridWidth; j++)
            {
                gridPoints[i, j] = new GridPoint(grid[i, j]);
                //gridPoints[i, j].targetPosition = gridPoints[i, j].position + Vector3.up * Random.Range(0f, 40f);
                positionsForLineRenderer[i * gridWidth + j] = gridPoints[i, j].position;

                //GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
                //cube.transform.parent = transform;
                //cube.transform.localPosition = gridPositions[i, j];
                //GameObject newLetter = Instantiate(letterPrefab);
                //newLetter.transform.parent = transform;
                //gridPoints[i, j].letter = newLetter;
            }
        }

        m_LineRenderer.positionCount = positionsForLineRenderer.Length;
        m_LineRenderer.SetPositions(positionsForLineRenderer);

        // Set up noise
        noiseOffset = Random.insideUnitCircle * 1000f;

        targetScale = noiseScale;

        NodeServerManager.APIReturned += ProcessWord;
    }