예제 #1
0
    private void CreateVoxel(OwlVoxel voxel)
    {
        GameObject newVoxel = Instantiate(this.voxel, Vector3.zero, Quaternion.identity);

        newVoxel.transform.SetParent(transform);

        newVoxel.transform.localScale = Vector3.one;

        newVoxel.transform.localPosition = new Vector3(voxel.x, voxel.y, voxel.z);
    }
예제 #2
0
    public OwlVoxelModel GenerateOVM()
    {
        OwlVoxelModel   newOVM = new OwlVoxelModel();
        List <OwlVoxel> voxels = new List <OwlVoxel>();

        foreach (Transform child in transform)
        {
            OwlVoxel newVoxel = new OwlVoxel();
            newVoxel.x = (int)child.localPosition.x;
            newVoxel.y = (int)child.localPosition.y;
            newVoxel.z = (int)child.localPosition.z;

            voxels.Add(newVoxel);
        }

        newOVM.AddVoxels(voxels.ToArray());

        return(newOVM);
    }
 public void AddVoxel(OwlVoxel voxel)
 {
     OwlVoxel[] lonelyArray = { voxel };
     AddVoxels(lonelyArray);
 }