22 lines
592 B
C#
22 lines
592 B
C#
using UnityEngine;
|
|
|
|
public class ScrollLeverOnHover : MonoBehaviour
|
|
{
|
|
void Update()
|
|
{
|
|
float scroll = Input.mouseScrollDelta.y;
|
|
if (scroll == 0) return;
|
|
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
if (Physics.Raycast(ray, out RaycastHit hit))
|
|
{
|
|
if (hit.collider.gameObject.tag == "LeverParent")
|
|
{
|
|
StrikerLeverController slc = hit.collider.gameObject.GetComponent<StrikerLeverController>();
|
|
if (slc != null) slc.currentAngle += scroll;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|