Пример #1
0
        public static EdgeRaycaster Create(Vector2 edge, LayerMask layerMask)
        {
            EdgeRaycaster instance = CreateInstance <EdgeRaycaster>();

            instance.layerMask = layerMask;
            instance.GenerateRayDeltas(edge);
            return(instance);
        }
Пример #2
0
        public static BoxRaycaster Create(BoxCollider2D collider, LayerMask layerMask)
        {
            BoxRaycaster instance = CreateInstance <BoxRaycaster>();

            instance.collider = collider;
            Bounds bounds = collider.bounds;

            instance.xEdge = EdgeRaycaster.Create(Vector2.right * bounds.size.x, layerMask);
            instance.yEdge = EdgeRaycaster.Create(Vector2.up * bounds.size.y, layerMask);
            return(instance);
        }