private void UpdateTopCasterPosition(Bounds bounds) { Vector2 mostLeftTop = bounds.GetMostLeftTop(); Vector2 mostRightTop = bounds.GetMostRightTop(); LineSequenceNonAllocCaster topRaycaster = this._boxCaster.topRaycaster; float num = mostLeftTop.y; if (topRaycaster.start.y < mostLeftTop.y - this._skinWidth) { topRaycaster.caster.contactFilter.SetLayerMask(this.terrainMask); topRaycaster.CastToLine(mostLeftTop, mostRightTop); for (int i = 0; i < topRaycaster.nonAllocCasters.Count; i++) { ReadonlyBoundedList <RaycastHit2D> results = topRaycaster.nonAllocCasters[i].results; if (results.Count != 0) { num = Mathf.Min(num, results[0].point.y - this._boxCaster.origin.y); } } num -= this._skinWidth; if (num < this._bounds.max.y) { return; } } Vector3 max = this._bounds.max; max.y = num; this._bounds.max = max; }
private void UpdateLeftCasterPosition(Bounds bounds) { Vector2 mostLeftTop = bounds.GetMostLeftTop(); Vector2 mostLeftBottom = bounds.GetMostLeftBottom(); LineSequenceNonAllocCaster leftRaycaster = this._boxCaster.leftRaycaster; float num = mostLeftTop.x; if (leftRaycaster.start.x > mostLeftTop.x + this._skinWidth) { leftRaycaster.caster.contactFilter.SetLayerMask(this.terrainMask); leftRaycaster.CastToLine(mostLeftTop, mostLeftBottom); for (int i = 0; i < leftRaycaster.nonAllocCasters.Count; i++) { ReadonlyBoundedList <RaycastHit2D> results = leftRaycaster.nonAllocCasters[i].results; if (results.Count != 0) { num = Mathf.Max(num, results[0].point.x - this._boxCaster.origin.x); } } num += this._skinWidth; if (num > this._bounds.min.x) { return; } } Vector3 min = this._bounds.min; min.x = num; this._bounds.min = min; }
private void UpdateRightCasterPosition(Bounds bounds) { Vector2 mostRightTop = bounds.GetMostRightTop(); Vector2 mostRightBottom = bounds.GetMostRightBottom(); LineSequenceNonAllocCaster rightRaycaster = this._boxCaster.rightRaycaster; float num = mostRightTop.x; if (rightRaycaster.start.x < mostRightTop.x - this._skinWidth) { rightRaycaster.caster.contactFilter.SetLayerMask(this.terrainMask); rightRaycaster.CastToLine(mostRightTop, mostRightBottom); for (int i = 0; i < rightRaycaster.nonAllocCasters.Count; i++) { ReadonlyBoundedList <RaycastHit2D> results = rightRaycaster.nonAllocCasters[i].results; if (results.Count != 0) { num = Mathf.Min(num, results[0].point.x - this._boxCaster.origin.x); } } num -= this._skinWidth; if (num < this._bounds.max.x) { return; } } Vector3 max = this._bounds.max; max.x = num; this._bounds.max = max; }
private void UpdateBottomCasterPosition(Bounds bounds) { Vector2 mostLeftBottom = bounds.GetMostLeftBottom(); Vector2 mostRightBottom = bounds.GetMostRightBottom(); LineSequenceNonAllocCaster bottomRaycaster = this._boxCaster.bottomRaycaster; float num = mostLeftBottom.y; if (bottomRaycaster.start.y > mostLeftBottom.y + this._skinWidth) { bottomRaycaster.caster.contactFilter.SetLayerMask(this.terrainMask); bottomRaycaster.CastToLine(mostLeftBottom, mostRightBottom); for (int i = 0; i < bottomRaycaster.nonAllocCasters.Count; i++) { ReadonlyBoundedList <RaycastHit2D> results = bottomRaycaster.nonAllocCasters[i].results; if (results.Count != 0) { num = Mathf.Max(num, results[0].point.y - this._boxCaster.origin.y); } } num += this._skinWidth; if (num > this._bounds.min.y) { return; } } Vector3 min = this._bounds.min; min.y = num; this._bounds.min = min; }