static void OnMouseInteraction(VldateSck.Input.InputLogical input, bool buttonDown) { MouseInteractable interactable = null; if (MouseCast(out interactable)) { if (interactable != null) { interactable.OnMouseInteraction(input, buttonDown); } } }
private static bool MouseCast(out MouseInteractable hitInteractable) { hitInteractable = null; mHitInfo = Physics2D.Raycast(InputManager.Instance.MousePosition2D, Vector2.zero); if (mHitInfo) { if (mHitInfo.collider != null) { hitInteractable = mHitInfo.collider.GetComponent <MouseInteractable> (); return(true); } } return(false); }