-
using System.Collections; using System.Collections.Generic; using UnityEngine; public class AudioController : MonoBehaviour { private AudioSource ads; // Start is called before the first frame update void Start() { ads=this.GetComponent<AudioSource>(); } // Update is called once per frame void OnGUI() { if (GUILayout.Button("play")) { if (!ads.isPlaying) { ads.Play(); } } if (GUILayout.Button("stop")) { if (ads.isPlaying) { ads.Stop(); } } } }
查看全部 -
游戏:~音乐和背景音乐查看全部
-
视觉效果和听觉效果查看全部
-
//移动控制
using UnityEngine;
using System.Collections;
public class player:MonoBehaviour{
public float speed=5f;
public float rotationSpeed=3f;
private Rigidbody rigidbody;
void Start(){
rigidbody=this.GetComponent<Rigidbody>();
}
void FixedUpdate(){
float h=Input.GetAxis("Mouse X");
float v=Input.GetAxis("Vertical");
rigidbody.velocity=transform.forward*v*speed;
rigidbody.angularVelocity=transform.up*h*rotationSpeed;
}
}
//控制门
void OnTriggerEnter(Collider collider){
if(collider.tag=="player"){
transform.position=new Vector3(transform.position.x,transform.position.y+3.6f,transform.position.z);
}
}
//播放声音
private AudioSource audioSource;
audioSource=this.GetComponent<AudioSource>();
audioSource.Play();
查看全部 -
using UnityEngine; using System.Collections; public class AudioController:MonoBehaviour{ private AudioSource ads; void Start(){ ads=this.GetComponent<AudioSource>(); } void OnGUI(){ if(GUILayout.Button("play")){ if(!ads.isPlaying) ads.Play(); } } }
查看全部 -
设置多普勒查看全部
-
boxcolider调大,便于检测碰撞物体查看全部
-
先私有化audiosource组件,开始时得到它查看全部
-
设置播放暂停按钮查看全部
-
混响 reverb zone查看全部
-
ogg 可用于长时间的音频。查看全部
-
1查看全部
-
。。。。查看全部
举报