Exemple #1
0
    public void CreateWallFromGridArray()
    {
        GameObject wallPrefab = Resources.Load("Wall/Wall", typeof(GameObject)) as GameObject;

        for (int i = 0; i < gridColumnCount; i++)
        {
            for (int j = 0; j < gridRowCount; j++)
            {
                if (gridArrayColumn[i].gridRow[j].filled)
                {
                    Vector3 tempPos = gridArrayColumn[i].gridRow[j].pos;
                    tempPos.y = 0.5f + gridScale;
                    GameObject wallInstance = Instantiate(wallPrefab, tempPos, Quaternion.identity) as GameObject;
                    wallInstance.transform.parent = transform;
                }
            }
        }

        MeshUtility.CombinetheMeshesInChildren(transform);
    }