【01】Unity
来源:互联网 发布:男士单肩包推荐 知乎 编辑:程序博客网 时间:2024/05/16 11:32
今天上午老师给我们讲了用C#对物体进行克隆,销毁下面是示例代码:先对GoCube进行克隆,然后再销毁
public class Excer_01 : MonoBehaviour {public GameObject GoCube;// Use this for initializationvoid Start () {//克隆GoCubeGameObject GOCloneCube = Instantiate (GoCube) as GameObject;//设置克隆物体的位置GOCloneCube.transform.position = new Vector3 (3, 0, 0);Destroy (GoCube,5);//5秒之后销毁GoCube}// Update is called once per framevoid Update () {}}
通过一个脚本完成:
- 太阳自转
- 地球自转 + 公转
- 月亮自转 + 公转
public class SunEarthMoon : MonoBehaviour {public GameObject GoSun; //太阳public GameObject GoEarth;//地球public GameObject GoMoon; //月亮public int IntSunSpeedSelf;//太阳自转速度public int IntEarthSpeedSelf;//地球自转速度public int IntEarthSpeedAround;//地球公转的速度public int IntMoonSpeedSelf;//月球自转速度public int IntMootSpeedAround;//月球公转的速度void Start () {}// Update is called once per framevoid Update () {//太阳GoSun.transform.Rotate (Vector3.up * Time.deltaTime * IntSunSpeedSelf);//地球GoEarth.transform.Rotate (Vector3.up * Time.deltaTime * IntEarthSpeedSelf);GoEarth.transform.RotateAround (GoSun.transform.position, Vector3.up, Time.deltaTime * IntEarthSpeedAround);//月亮GoMoon.transform.Rotate (Vector3.up * Time.deltaTime * IntMoonSpeedSelf);GoMoon.transform.RotateAround (GoEarth.transform.position, Vector3.up, Time.deltaTime * IntMootSpeedAround);}}
0 0
- 【01】Unity
- unity界面学习01
- Unity 5 初学-01
- Unity学习笔记.01
- unity
- Unity
- unity
- Unity
- Unity
- Unity
- Unity-----
- unity
- Unity
- unity
- unity
- Unity
- Unity
- Unity
- iOS开发UI篇—推荐两个好用的Xcode插件(提供下载链接)
- 关于Ubuntu配置文件apache2 httpd.conf 位置
- 【Android实现程序前后台切换效果】(二)Android采用Service方式实现程序前后台切换效果
- 编写一个函数,将一个数字字符串转换成该字符串对应的数字(包括正整数、负整数)
- To avoid user confusion, app version updates must utilize the iOS built-in update mechanism.
- 【01】Unity
- IDEA+maven+Android
- 更相减损术
- XMPP结构
- 通用app原创过程中GridView、ScrollView遇到的问题
- 【Android】短信应用——短信截获
- [Golang]设计模式实践:组合(Composite)
- android OpenGL ES 2.0 Shader相关介绍
- JavaScript基础