33 lines
903 B
C#
33 lines
903 B
C#
using UnityEngine;
|
|
|
|
public class ScrollOnHover : MonoBehaviour
|
|
{
|
|
|
|
void Update()
|
|
{
|
|
float scroll = Input.mouseScrollDelta.y;
|
|
|
|
|
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
if (Physics.Raycast(ray, out RaycastHit hit))
|
|
{
|
|
if (hit.collider.gameObject.tag == "LeverParent")
|
|
{
|
|
if (scroll == 0) return;
|
|
StrikerLeverController slc = hit.collider.gameObject.GetComponent<StrikerLeverController>();
|
|
if (slc != null)
|
|
{
|
|
slc.RotateLever(scroll);
|
|
}
|
|
}
|
|
if (hit.collider.gameObject.tag == "FlyButton")
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.E) ) {
|
|
hit.collider.gameObject.GetComponent<RocketButtonController>().Use();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|