protected override bool Colliding(VCTouchWrapper tw) { if (this._collider != null) { return(base.AABBContains(tw.position)); } Rect screenRect = this._colliderGuiTexture.GetScreenRect(); VCUtils.ScaleRect(ref screenRect, this.hitRectScale); return(screenRect.Contains(tw.position)); }
protected override bool Colliding(VCTouchWrapper tw) { // hit test against a collider if we have one if (_collider != null) { return(AABBContains(tw.position)); } // otherwise, fall back to a rect hit test on the guiTexture Rect r = _colliderGuiTexture.GetScreenRect(); VCUtils.ScaleRect(ref r, hitRectScale); return(r.Contains(tw.position)); }
protected override bool Colliding(VCTouchWrapper tw) { if (!tw.Active) { return(false); } // first try and hitTest against a collider if we have one if (_collider != null) { return(AABBContains(tw.position)); } // otherwise, fall back to a rect hit test on the guiTexture (this is what most people will want) Rect r = _movingPartGuiTexture.GetScreenRect(); VCUtils.ScaleRect(ref r, hitRectScale); return(r.Contains(tw.position)); }
public static void ScaleRect(ref Rect r, Vector2 scale) { VCUtils.ScaleRect(ref r, scale.x, scale.y); }