private void Update() { var mouseWorldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); var mouseWandDelta = (mouseWorldPosition - transform.position).normalized; var rotationAngle = Mathf.Atan(mouseWandDelta.y / mouseWandDelta.x) * Mathf.Rad2Deg; transform.localRotation = Quaternion.Euler(Vector3.forward * rotationAngle); // Hot spell if (UnlockManager.Instance != null && UnlockManager.Instance.UnlockedFireBall && Input.GetButton(InputAxesLiterals.UseSelectedHotSpell)) { _fireballSpell.Cast(_player); Dispatch(new EventObject { Sender = this, Type = SpellCast, Data = _fireballSpell }); } // Cold spell if (UnlockManager.Instance != null && UnlockManager.Instance.UnlockedIceBeam && Input.GetButton(InputAxesLiterals.UseSelectedColdSpell)) { _iceBeamSpell.Cast(_player); Dispatch(new EventObject { Sender = this, Type = SpellCast, Data = _iceBeamSpell }); } if (Input.GetButtonUp(InputAxesLiterals.UseSelectedColdSpell) && _iceBeamSpell.IsCasting) { _iceBeamSpell.StopCasting(_player); } }