unity js操作模型 加音频 需修改
2015-03-19 23:45
260 查看
#pragma strict
function Start () {
}
var run =0;
var isOn:boolean;
var RotateSpeed = 1000;
var aaudio:AudioSource;
function Update () {
if (Input.touchCount == 1)
{
if(isOn == true){
isOn=false;
} else{
isOn=true;
}
//One finger touch does orbit
//
// touch = Input.GetTouch(0);
//
// x += touch.deltaPosition.x * xSpeed * 0.02;
//
// y -= touch.deltaPosition.y * ySpeed * 0.02;
}
if(isOn == true){
transform.Rotate(Vector3.up * Time.deltaTime * (-RotateSpeed));
aaudio=this.GetComponent(AudioSource);
aaudio.Play();
}
}
function OnGUI()
{
//开关按钮,使用了三目运算符来控制显示on或者off
if(GUI.Button(Rect(0,0,200,40),(isOn)?"on":"off"))
{
//用三目运算符控制布尔类型开关变量值
if(isOn==true){
isOn=false;
}else{
isOn=true;
}
}
if(isOn)
{
//其他按钮的代码
}
}
function Start () {
}
var run =0;
var isOn:boolean;
var RotateSpeed = 1000;
var aaudio:AudioSource;
function Update () {
if (Input.touchCount == 1)
{
if(isOn == true){
isOn=false;
} else{
isOn=true;
}
//One finger touch does orbit
//
// touch = Input.GetTouch(0);
//
// x += touch.deltaPosition.x * xSpeed * 0.02;
//
// y -= touch.deltaPosition.y * ySpeed * 0.02;
}
if(isOn == true){
transform.Rotate(Vector3.up * Time.deltaTime * (-RotateSpeed));
aaudio=this.GetComponent(AudioSource);
aaudio.Play();
}
}
function OnGUI()
{
//开关按钮,使用了三目运算符来控制显示on或者off
if(GUI.Button(Rect(0,0,200,40),(isOn)?"on":"off"))
{
//用三目运算符控制布尔类型开关变量值
if(isOn==true){
isOn=false;
}else{
isOn=true;
}
}
if(isOn)
{
//其他按钮的代码
}
}
相关文章推荐
- unity js操作模型 加音频 需修改
- js操作unity模型旋转
- js操作unity模型旋转
- unity模型缩放被自动修改
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- js 对html 元素操作,添加删除修改
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在
- 给页面路径加上或修改某参数(js操作)
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- Javascrip-js操作数组-Array-添加-修改数组-charje的博客
- Js操作表格-对表格单元格的添加删除修改
- js操作select控件大全(新增、修改、删除、选择)
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等
- JS操作select相关方法:新增 修改 删除 选中 清空 判断存在 等