Unity 3D
Kris沉默
这个作者很懒,什么都没留下…
展开
-
移动打印X坐标
#pragma strictfunction Start () {}var speed:int=5;function Update () { var x:float=Input.GetAxis("Horizontal")*Time.deltaTime*speed; var z:float=Input.GetAxis("Vertical")*Time.deltaTim原创 2014-09-13 22:59:28 · 555 阅读 · 0 评论 -
在代码中获得物体,改变属性
gameObject.Find("wenzi").GetComponent(GUIText).guiText="";原创 2014-09-14 21:19:06 · 1035 阅读 · 0 评论 -
发射球体和销毁球体
#pragma strictfunction Start () {}var newobject:Transform;function Update () { if(Input.GetButtonDown("Fire1")) { //实例化命令: //用Instantiate(要生成的物体,生成的位置,生成物体的旋转角度) var n:Transfo原创 2014-09-14 19:47:02 · 477 阅读 · 0 评论 -
实现物体的左右旋转
#pragma strictfunction Start () {}var newobject:Transform;function Update () { //Rotate(x,y,z,延着自身的轴进行旋转);下面代码是实现左右旋转 if(Input.GetKey(KeyCode.Q)) { transform.Rotate(0,-25*Ti原创 2014-09-14 20:01:17 · 531 阅读 · 0 评论 -
添加按钮
function OnGUI(){ //Rect(x,y,长,高) if(GUI.Button(Rect(180,100,60,30),"退出")){ Application.Quit(); } if(GUI.Button(Rect(280,100,60,30),"重新开始")){ //LoadLevel(场景) Application.LoadLevel原创 2014-09-14 21:38:06 · 514 阅读 · 0 评论