mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 19:55:09 +00:00
24 lines
No EOL
550 B
C#
24 lines
No EOL
550 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace RhythmHeavenMania.Common
|
|
{
|
|
public class FollowMouse : MonoBehaviour
|
|
{
|
|
public Vector2 offset;
|
|
public Camera cam;
|
|
|
|
private void Awake()
|
|
{
|
|
if (cam == null)
|
|
cam = Camera.main;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
var pos = cam.ScreenToWorldPoint(Input.mousePosition);
|
|
transform.position = new Vector3(pos.x - offset.x, pos.y - offset.y, 0);
|
|
}
|
|
}
|
|
} |