本文整理汇总了C#中UnityEngine.AudioSource类的典型用法代码示例。如果您正苦于以下问题:C# AudioSource类的具体用法?C# AudioSource怎么用?C# AudioSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudioSource类属于UnityEngine命名空间,在下文中一共展示了AudioSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
// Use this for initialization
void Awake ()
{
player = GameObject.FindGameObjectWithTag("Player");
playerControl = player.GetComponent<playerControl>();
som = gameObject.GetComponent<AudioSource>();
bala = gameObject.GetComponent<MeshRenderer>();
}
示例2: Start
// Use this for initialization
void Start()
{
// Script References
shipGraphics = GetComponent<ShipGraphics>();
shipPhysicsScript = GetComponent<ShipPhysicsScript>();
// Component Variables
cam = GetComponentInChildren<Camera>();
body = GetComponent<Rigidbody>();
model = transform.Find("Model").gameObject;
capsuleCollider = GetComponentInChildren<CapsuleCollider>();
boxCollider = GetComponentInChildren<BoxCollider>();
lockSound = GetComponent<AudioSource>();
// Control Variables
mouseSensitivity = 8.0f;
//mouseThreshold = 8.0f;
//buttonSensitivity = 0.05f;
//buttonThreshold = 0.05f;
horTranslation = 0.0f;
verTranslation = 0.0f;
enemyNoLock = (Material)Resources.Load("Crosshair");
enemyLock = (Material)Resources.Load("Crosshair_Enemy");
trackedObject = null;
trackingResults = null;
shootWaitTime = 0.0f;
targetTime = 0.0f;
hits = 0;
}
示例3: getAudioSource
protected AudioSource getAudioSource()
{
if(soundEmitter == null) {
soundEmitter = GetComponent<AudioSource>();
}
return soundEmitter;
}
示例4: Start
void Start()
{
audioSource = GetComponent<AudioSource>();
driver = GameObject.Find("GameDriver") as GameObject;
shadow = transform.FindChild("RimShadow");
shadowDistance = (transform.position - shadow.position).magnitude;
}
示例5: Start
// Use this for initialization
void Start()
{
startShooting = false;
shootingBullet = false;
audio = GetComponent<AudioSource>();
//spawnPosition = GetComponent<Transform>().position;
}
示例6: Awake
void Awake()
{
rb2d = GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
aud = GetComponent<AudioSource>();
jps = transform.GetChild(2).GetComponent<ParticleSystem>();
}
示例7: Start
// Use this for initialization
void Start()
{
controlledObj = mechanism.GetComponent<BatteryControlledObject>();
source = GetComponent<AudioSource>();
source.loop = true;
source.clip = insertSound;
}
示例8: a0
void a0()
{
audioSource = GetComponent<AudioSource>();
audioSource.Play();
Invoke("d", 2.1f);
Invoke("a1", 10);
}
示例9: Start
protected void Start()
{
audioComponent = GetComponent<AudioSource>();
audioVolume = audioComponent.volume;
audioComponent.enabled = TOD_Sky.Instance.IsDay;
}
示例10: Start
void Start ()
{
// 各アビリティボタンの親であるMaskをアタッチしているオブジェクトを取得
attackParentGO = GameObject.Find("Tab_Action").transform.FindChild("Mask").gameObject;
defenceParentGO = GameObject.Find("Tab_Support").transform.FindChild("Mask").gameObject;
reactionParentGO = GameObject.Find("Tab_Reaction").transform.FindChild("Mask").gameObject;
moveParentGO = GameObject.Find("Tab_Move").transform.FindChild("Mask").gameObject;
// 初期化としてアタックタブをアクティブ化、それ以外のタブを非アクティブ化する
attackParentGO.SetActive(true);
defenceParentGO.SetActive(false);
reactionParentGO.SetActive(false);
moveParentGO.SetActive(false);
// 非アクティブタブのテキスト文字色変更のためタブのテキストコンポを取得
attackTabTextCompo = GameObject.Find("Tab_Action").transform.FindChild("Text").GetComponent<Text>();
defenceTabTextCompo = GameObject.Find("Tab_Support").transform.FindChild("Text").GetComponent<Text>();
reactionTabTextCompo = GameObject.Find("Tab_Reaction").transform.FindChild("Text").GetComponent<Text>();
moveTabTextCompo = GameObject.Find("Tab_Move").transform.FindChild("Text").GetComponent<Text>();
// 初期化としてアタックタブ以外を灰色にする
attackTabTextCompo.color = new Color(255, 255, 255);
defenceTabTextCompo.color = Color.grey;
reactionTabTextCompo.color = Color.grey;
moveTabTextCompo.color = Color.grey;
// オーディオコンポを取得
audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
// TODO 本当はリクワイヤードコンポ属性を使うべき。上手く動いてくれなかったのでとりあえず
if (null == audioCompo) audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
}
示例11: Start
public void Start(){
audio = GetComponent<AudioSource> ();
if (GetComponent<PhotonView> ().isMine) {
c = Microphone.Start (null, true, 100, freq);
while(Microphone.GetPosition(null) < 0) {}
}
}
示例12: Start
void Start()
{
player = GetComponent<Player>();
audioSource = GetComponent<AudioSource>();
quadRenderer = GetComponentInChildren<Renderer>();
startColor = quadRenderer.material.color;
victoryText.text = "";
health = 100;
if(winCount == null) {
winCount = new int[2];
winCount[0] = 0;
winCount[1] = 0;
}
deadNow = false;
if (winCount[player.number] > 0)
{
winCountText.text = winCount[player.number].ToString();
winCountText.text += winCount[player.number] == 1 ? " WIN" : " WINS";
winCountText.gameObject.SetActive(true);
}
Debug.Log("Player " + player.number + "win count = " + winCount[player.number]);
}
示例13: Start
void Start () {
this.anim1 = this.conversante1.GetComponent<Animator> ();
this.anim2 = this.conversante2.GetComponent<Animator> ();
this.texto = GameObject.Find ("Dialogo").GetComponent<Text> ();
TextAsset archivo = Resources.Load(this.fichero) as TextAsset;
this.contenidoFichero = archivo.text;
this.conversaciones = this.contenidoFichero.Split ('\n');
this.numConver = 0;
this.primeraConversacion = true;
this.siguienteConversacion = false;
this.audioActual = this.gameObject.GetComponent<AudioSource> ();
//Inicializamos el clip del audio.
this.audioActual.clip = this.audio1;
//Registramos la informacion del Analytics
if (Tracker.T () != null) {
this.registrarTracker ();
}
if (this.fichero == "Transicion1")
this.anim2.SetBool("contenta", false);
}
示例14: Initialize
void Initialize()
{
if (initialized) return;
initialized = true;
audioSource = gameObject.GetComponent<AudioSource>();
}
示例15: Start
// Use this for initialization
void Start()
{
lightColors = "Blue";
canShoot = true;
Cursor.visible = false;
audio = GetComponent<AudioSource>();
}