public void UpdateCursor(PlayerWeaponHandler handler) { if (currentCursor != null) { currentCursor.CursorUpdate(handler); } }
public override void CursorUpdate(PlayerWeaponHandler handler) { cursorTransform.localPosition = ScreenToLocalPosition(Input.mousePosition); Ray screenRay = rootCanvas.worldCamera.ScreenPointToRay(Input.mousePosition); RaycastHit screenRayHit; if (Physics.Raycast(screenRay, out screenRayHit)) { handler.AimWeapon(screenRayHit.point); if (Input.GetKeyDown(KeyCode.Mouse0)) { handler.AttackWithTargetPosition(screenRayHit.point); } } }
public override void CursorUpdate(PlayerWeaponHandler handler) { cursorTransform.localPosition = ScreenToLocalPosition(Input.mousePosition); screenRay = aimingCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(screenRay, out screenRayHit)) { Vector3 aimingOrigin = playerTransform.localPosition; aimingRay = new Ray(aimingOrigin, (screenRayHit.point - aimingOrigin).normalized); if (Physics.Raycast(aimingRay, out aimingRayHit)) { rayGuideTransform.localPosition = WorldToLocalPosition(aimingRayHit.point); if (Input.GetKeyDown(KeyCode.Mouse0)) { handler.AttackWithTargetPosition(aimingRayHit.point); } } } }
public abstract void CursorUpdate(PlayerWeaponHandler handler);
public override void CursorUpdate(PlayerWeaponHandler handler) { }