【发布时间】:2015-06-26 00:40:37
【问题描述】:
我有一个button 和一个PlayerObject。当我单击按钮时,对象必须连续旋转,当我再次单击同一个按钮时,对象必须停止旋转。目前,我正在使用下面给出的代码。它使物体只旋转一次到一定的角度。
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
int a=1;
public void CubeRotate () {
a++;
transform.Rotate (new Vector3 (150, 300, 60) * Time.deltaTime);
if (a%2==0) {
Debug.Log(a);
transform.Rotate (new Vector3 (150, 300, 60) * Time.deltaTime);
}
}
}
请帮忙。提前致谢。
【问题讨论】:
标签: c# unity3d unityscript