예제 #1
0
    bool isValidGridPos()
    {
        foreach (Transform child in transform)
        {
            Vector3 v = Grid3d.roundVec3(child.position);

            // Not inside Border?
            if (!Grid3d.insideBorder(v))
            {
                return(false);
            }

            // Block in grid cell (and not part of same group)?

            if (Grid3d.grid[(int)v.x, (int)v.y, (int)v.z] != null &&
                Grid3d.grid[(int)v.x, (int)v.y, (int)v.z].parent != transform)
            {
                return(false);
            }
        }
        return(true);
    }