DirectionGUI

原创
2013/06/08 16:54
阅读数 59

using UnityEngine;
using System.Collections;

public class DirectionGUI : MonoBehaviour {
 
 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () {
 
 }
 
 void OnGUI(){
 
  if(GUI.Button(new Rect (Screen.width - 150,Screen.height - 150,100,50), "前"))
   
  {
   
   transform.Translate(Vector3.back* Time.deltaTime*20);
  }
  if(GUI.Button(new Rect (Screen.width - 100,Screen.height - 100,100,50), "右"))
  {
   transform.Translate(Vector3.left* Time.deltaTime*20);
   
  }
  
  if(GUI.Button(new Rect (Screen.width - 150,Screen.height - 50,100,50), "后"))
  {
   transform.Translate(Vector3.forward* Time.deltaTime*20);
   
  }
  
  if(GUI.Button(new Rect (Screen.width - 200,Screen.height - 100,100,50), "左"))
  {
   
   transform.Translate(Vector3.right* Time.deltaTime*20);
   
  }
  

 }

}

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部