void Update() { Vector3 mousePosition = Input.mousePosition; mousePosition.z = distanceFromScreen; Vector3 worldMousePosition = Camera.main.ScreenToWorldPoint(mousePosition); arrowRenderer.SetPositions(Vector3.zero, worldMousePosition); }
private void FixedUpdate() { if (boardController.selectedItemDrop == this) { arrowRenderer.enabled = true; Vector3[] positions = new Vector3[2]; positions[0] = this.transform.position; if (boardController.mousedOverNPC != null) { positions[1] = boardController.mousedOverNPC.transform.position; arrowRenderer.SetPositions(this.transform.position, boardController.mousedOverNPC.transform.position); } else { positions[1] = this.transform.position; arrowRenderer.SetPositions(this.transform.position, this.transform.position); } } else { arrowRenderer.SetPositions(this.transform.position, this.transform.position); } }
protected void SpellTargeting() { if (arrow != null) { arrow.SetPositions(spellCaster.transform.position, CursorStalker.GameCursor.Target.transform.position); } if (CursorStalker.GameCursor.Target != CursorStalker.GameCursor.gameObject) { spellTarget = CursorStalker.GameCursor.Target.GetComponent <Land>(); } else { spellTarget = null; } }
void ArrowUpdate() { Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mousePos = new Vector3(mousePos.x, mousePos.y, 0); Vector3 start = new Vector3(CardManager.instance.currentDragCard.transform.position.x, CardManager.instance.currentDragCard.transform.position.y, 0); if ((mousePos - start).magnitude < 1.4f) { if (arrow.gameObject.activeSelf) { arrow.gameObject.SetActive(false); } } else { if (!arrow.gameObject.activeSelf) { arrow.gameObject.SetActive(true); } arrow.SetPositions(start, mousePos); } }