标签:游戏 unity3d javascript
通过声明gameobject对象,实现一个脚本用于多个对象
#pragma strict //code:myhaspl@myhaspl.com //date:2014-08-12 var rotate_object:GameObject; var translate_object:GameObject; var fuhao:int; fuhao=-1; function Update () { if (rotate_object!=null){ rotate_object.transform.Rotate(1,1,-1); } if (translate_object!=null) { if (translate_object.transform.position.y<9 ){ fuhao=1; } if (translate_object.transform.position.y>15) { fuhao=-1; } translate_object.transform.Translate (0,fuhao*0.1,0); } }
运行效果如下链接所示:
http://mygame.myhaspl.com/test2/test2.html
深入浅出游戏算法(4)-unity3d算法(2)-移动球,布布扣,bubuko.com
标签:游戏 unity3d javascript
原文地址:http://blog.csdn.net/myhaspl/article/details/38515677