32 lines
598 B
C#
32 lines
598 B
C#
using UnityEngine;
|
|
|
|
namespace Artngame.SKYMASTER
|
|
{
|
|
public class RotateLightSMU : MonoBehaviour
|
|
{
|
|
public float speed = 5f;
|
|
|
|
private Vector3 lastMousePos;
|
|
|
|
private bool rotate;
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetMouseButtonDown(0))
|
|
{
|
|
rotate = true;
|
|
}
|
|
if (Input.GetMouseButtonUp(0))
|
|
{
|
|
rotate = false;
|
|
}
|
|
Vector3 vector = lastMousePos - Input.mousePosition;
|
|
if (rotate)
|
|
{
|
|
base.transform.Rotate(new Vector3(vector.y * Time.deltaTime * (0f - speed), vector.x * Time.deltaTime * (0f - speed), 0f));
|
|
}
|
|
lastMousePos = Input.mousePosition;
|
|
}
|
|
}
|
|
}
|