【发布时间】:2021-07-07 17:56:43
【问题描述】:
我目前正在以初学者的身份制作 2D 游戏。我已经为统一添加了一个旋转平台。现在我希望平台等待几秒钟,当平台是直的,然后再转身,就像在 gif 上一样。这样你就可以在统一的右侧轻松选择秒数。有人可以解释一下吗?
谢谢
当前脚本:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spinning_Platform : MonoBehaviour
{
private float rotZ;
public float RotationSpeed;
public bool ClockwiseRotation;
void Update()
{
if (ClockwiseRotation==false)
{
rotZ += Time.deltaTime * RotationSpeed;
}
else
{
rotZ += -Time.deltaTime * RotationSpeed;
}
transform.rotation = Quaternion.Euler(0, 0, rotZ);
}
}
【问题讨论】: