unity3d 第四天
来源:互联网 发布:彩票号码组合软件 编辑:程序博客网 时间:2024/05/18 17:02
Slider控件
value=GUI.VerticalSlider(postion,float,float,float);
value=GUI.HorizontalSlider(postion,float,float,float);
slider_test.cs
using UnityEngine;using System.Collections;public class Slider_test : MonoBehaviour {float verticalValue = 0.0f;float horizontaValue = 0.0f;// Use this for initializationvoid OnGUI(){//计算滑动进度verticalValue = GUI.VerticalSlider ( new Rect(25,25,30,100),verticalValue,100.0f,0.0f); //上 下 滑动指针停留在值最小的一边horizontaValue = GUI.HorizontalSlider (new Rect (50,25,100,30),horizontaValue,0.0f,100.0f);//左 右//将滑动进度显示在屏幕中GUI.Label(new Rect(10,180,Screen.width,30),"纵向滑动当前进度条:"+ verticalValue + "%");GUI.Label (new Rect (10, 210, Screen.width, 30), "横向滑动当前进度条:" + horizontaValue + "%");}void Start () {}// Update is called once per framevoid Update () {}}
按键控制cube移动 旋转
using UnityEngine;using System.Collections;public class cube_move : MonoBehaviour {public int movespeed;// Use this for initializationvoid Start () {movespeed = 10;}// Update is called once per framevoid Update () {//键盘按下事件if (Input.GetKeyDown (KeyCode.W)) {transform.Translate(Vector3.forward * movespeed);}if (Input.GetKeyDown (KeyCode.S)) {transform.Translate(Vector3.forward * (-movespeed));}if (Input.GetKeyDown (KeyCode.D)) {transform.Translate(Vector3.right * movespeed);}if (Input.GetKeyDown (KeyCode.A)) {transform.Translate(Vector3.right * (-movespeed));}//up right forward 分别控制三个面的旋转if (Input.GetKeyDown (KeyCode.E)) {transform.Rotate (Vector3.up * movespeed);}if (Input.GetKeyDown (KeyCode.Q)) {transform.Rotate (Vector3.up * (-movespeed));}}}
0 0
- unity3d 第四天
- unity3d 第四天 物理引擎 刚体
- Unity3D学习之第四天(脚本入门)
- Unity3D笔记第四天——常用类
- (五)Unity3d第四次面试
- Unity3D逆向基础教程第四课
- 学习Unity3D第四天之脚本入门(数据类型和基本运算)。
- (第四章)Unity3D-地球旋转Dome
- 第四天
- 第四天
- 第四天
- 第四天
- 第四天
- 第四天
- 第四天
- 第四天
- 第四天
- 第四天
- Hdu3037 Saving Beans Lucas定理
- 学习笔记 cocos2d-x 2.x到3.x的改动与区别
- iOS/mac开发的一些知名个人博客
- MagicNumber求平方根倒数
- Lucas定理模板
- unity3d 第四天
- 2016.7.15
- Unity5学习心得-Gameplay
- UESTC 2016 Summer Training #5 Div.2(未完待续)
- CC2540/CC2541/CC254x之OSAL操作系统抽象层
- Android中的URL Scheme
- **PHP** 多维数组和日期
- 数据结构与算法总结4_排序算法
- Thread中的uncheckedException的处理