2022-01-09 23:35:55 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace RhythmHeavenMania.Common
|
|
|
|
{
|
|
|
|
public class FollowMouse : MonoBehaviour
|
|
|
|
{
|
2022-01-11 00:17:29 +00:00
|
|
|
public Vector2 offset;
|
2022-02-03 08:25:27 +00:00
|
|
|
public Camera cam;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
if (cam == null)
|
|
|
|
cam = Camera.main;
|
|
|
|
}
|
2022-01-11 00:17:29 +00:00
|
|
|
|
2022-01-09 23:35:55 +00:00
|
|
|
private void Update()
|
|
|
|
{
|
2022-02-03 08:25:27 +00:00
|
|
|
var pos = cam.ScreenToWorldPoint(Input.mousePosition);
|
2022-01-11 00:17:29 +00:00
|
|
|
transform.position = new Vector3(pos.x - offset.x, pos.y - offset.y, 0);
|
2022-01-09 23:35:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|