Exemple #1
0
        public bool IsAreaFree(Vector2 position, Vector2 size)
        {
            if (!mMapData.GetIsAreaFree(position, size))
            {
                return(false);
            }

            var bounds = new Rect(position, size);

            for (int i = 0; i < ChildContainer.transform.childCount; i++)
            {
                var child       = ChildContainer.transform.GetChild(i).gameObject;
                var boundsOwner = child.GetComponent <IFlatBoundsOwner>();

                if (bounds.Overlaps(boundsOwner.FlatBounds))
                {
                    return(false);
                }
            }
            //foreach child in childcontainer, check box collisions
            return(true);
        }