private bool DoRaycast() { var testObject = GameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : GameObject.GameObject.Value; // ActionHelpers uses a cache to try and minimize Raycasts var hitInfo = Physics2D.GetRayIntersection(Camera.main.ScreenPointToRay(ActionHelpers.GetMousePosition()), Mathf.Infinity, ActionHelpers.LayerArrayToLayerMask(layerMask, invertMask.Value)); // Store mouse pick info so it can be seen by Get Raycast Hit Info action Fsm.RecordLastRaycastHit2DInfo(Fsm, hitInfo); if (hitInfo.transform != null) { if (hitInfo.transform.gameObject == testObject) { return(true); } } return(false); }
public override void OnGUI() { // Handled by PlayMakerGUI? if (PlayMakerGUI.Exists) { return; } // draw custom cursor var texture = cursorTexture.Value; if (texture != null) { var mousePos = ActionHelpers.GetMousePosition(); var pos = new Rect(mousePos.x - texture.width * 0.5f, Screen.height - mousePos.y - texture.height * 0.5f, texture.width, texture.height); GUI.DrawTexture(pos, texture); } }