static ShapeObject[] OverlapCheck(Vector3 point, Vector3 size, Func <ShapeObject, CollisionData> CollidedCheckHandler) { ShapeObject[] checking = ShapeQuadTree.OverlapRect(point, size); List <ShapeObject> IsOverlapShape = new List <ShapeObject>(); for (int i = 0; i < checking.Length; i++) { ShapeObject checkedShape = checking[i]; if (CollidedCheckHandler.Invoke(checkedShape).HasCollision) { IsOverlapShape.Add(checkedShape); } } return(IsOverlapShape.ToArray()); }
void OverlapCheck() { //Overlap Check ShapeObject[] shapes = ShapeQuadTree.OverlapRect(mousePoint, checkRegion); foreach (var shape in shapes) { shape.SetColor(Color.black * 0.8f); } checkAngle += Input.mouseScrollDelta.y * 5; ShapeObject[] overlap = ShapesCollision.OverlapRectangle(mousePoint, checkAngle, checkRegion); foreach (var shape in overlap) { shape.SetColor(Color.white); } text.text = overlap.Length.ToString(); text.transform.position = new Vector3(mousePoint.x, mousePoint.y); }