24 lines
642 B
C#
24 lines
642 B
C#
|
|
|
|||
|
|
using UnityEngine;
|
|||
|
|
//ģ<>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
|
|||
|
|
public class MouseRow : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
private Rigidbody rigidbod;
|
|||
|
|
public bool isUse = true;
|
|||
|
|
public float speed = 2.5f;//<2F><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
|||
|
|
void Start()
|
|||
|
|
{
|
|||
|
|
rigidbod = this.GetComponent<Rigidbody>();
|
|||
|
|
}
|
|||
|
|
void Update()
|
|||
|
|
{
|
|||
|
|
if (!isUse) return;
|
|||
|
|
if (Input.GetMouseButton(0))
|
|||
|
|
{
|
|||
|
|
float OffsetX = Input.GetAxis("Mouse X");//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
|
|||
|
|
float OffsetY = Input.GetAxis("Mouse Y");//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
|
|||
|
|
transform.Rotate(new Vector3(OffsetY, -OffsetX, 0) * speed, Space.World);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|