Exemplo n.º 1
0
        // Use this for initialization
        void Start()
        {
            trunk   = FindObjectOfType <NaiveBlockTrunk>();
            terrain = FindObjectOfType <NaiveBlockTerrain>();
            for (int i = 0; i < trunk.trunkSize; i++)
            {
                for (int k = 0; k < trunk.trunkSize; k++)
                {
                    for (int j = 0; j < terrainHeight; j++)
                    {
                        trunk.cubes[i, j, k].fill = 1;
                    }
                    for (int j = terrainHeight; j < trunk.trunkHeight; j++)
                    {
                        trunk.cubes[i, j, k].fill = 0;
                    }
                }
            }

            terrain.transform.position = Vector2.up * trunk.cubeSize * terrainHeight;
            boxCollider      = gameObject.AddComponent <BoxCollider>();
            boxCollider.size = new Vector3(trunk.trunkSize * trunk.cubeSize,
                                           trunk.cubeSize,
                                           trunk.trunkSize * trunk.cubeSize);
            boxCollider.center    = Vector3.up * trunk.cubeSize * (terrainHeight + 0.5f);
            boxCollider.isTrigger = true;

            terrain.UpdateMesh();
            trunk.UpdateMesh();
        }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     trunk = GetComponent <NaiveBlockTrunk>();
 }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     trunk = GetComponent <NaiveBlockTrunk>();
     cubes = trunk.cubes;
 }