public class groy : MonoBehaviour {
float x;
float y;
Gyroscope go;
void Start()
{
go = Input.gyro;
go.enabled = true;
}
void Update()
{
x = Input.acceleration.x;
y = Input.acceleration.y;
this.GetComponent<Rigidbody>().AddForce(new Vector3(-x, 0, -y) * 20);
}
}
public class StartUi : MonoBehaviour {
public void Reaply()
{
Time.timeScale = 1;
Application.LoadLevel(1);
}
public void Quit()
{
Application.Quit();
}
}
public class Mover : MonoBehaviour {
public GameObject go;
private void OnTriggerStay(Collider other)
{
if (other.name == "target")
{
go.gameObject.SetActive(true);
Time.timeScale = 0;
}
else
{
Application.LoadLevel(1);
}
}
private void OnTriggerEnter(Collider other)
{
if (other.name == "target")
{
go.gameObject.SetActive(true);
Time.timeScale = 0;
}
else
{
Application.LoadLevel(1);
}
}
private void OnGUI()
{
GUIStyle style = new GUIStyle();
style.fontSize = 36;
if (GUI.Button(new Rect(50,30, 200,80 ), "返回菜单",style)){
Application.LoadLevel(0);
}
}
}
作者:Czhenya
链接:https://czhenya.blog.csdn.net/article/details/77408315
来源:CSDN
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。