基本交互和视觉效果确定
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GearController : MonoBehaviour
|
||||
{
|
||||
[Header("齿轮参数")]
|
||||
public float rotationSpeed = 360f;
|
||||
public float snapDistance = 0.3f;
|
||||
public float detachDistance = 10.0f;
|
||||
|
||||
private bool isRotating = false;
|
||||
|
||||
public void SetRotation(bool shouldRotate)
|
||||
{
|
||||
isRotating = shouldRotate;
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isRotating)
|
||||
{
|
||||
transform.Rotate(Vector3.forward, -rotationSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user