private void Awake() { targetGameObject = new GameObject(); audioPlayer = targetGameObject.AddComponent <AudioSourcePlayer>(); AudioClip clip = Resources.Load <AudioClip>("Audio/Music/Loop"); audioPlayer.FadeIn(clip, 3, 0, 1, 0, OnFadeInCompleteCallback); }
private void Awake() { targetGameObject = new GameObject(); audioPlayer = targetGameObject.AddComponent <AudioSourcePlayer>(); AudioClip clip = Resources.Load <AudioClip>("Audio/Music/Loop"); audioPlayer.PlayAudio(clip); Invoke("FadeOutLater", 3f); }
private void Awake() { targetGameObject = new GameObject(); audioPlayer = targetGameObject.AddComponent <AudioSourcePlayer>(); audioPlayer.AudioPlayCompleted.AddListener(OnAudioPlayCompleted); AudioClip clip = Resources.Load <AudioClip>("Audio/Sounds/Ring"); audioPlayer.PlayAudio(clip); }
void Start() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); controller = GetComponent <Controller2D>(); sr = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); impulseSource = GetComponent <CinemachineImpulseSource>(); gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); print("Gravity: " + gravity + " Jump Velocity: " + maxJumpVelocity); }
/// <summary> /// 销毁所有闲置中的多通道音效的音源 /// </summary> public void ClearIdleMultipleAudioSource() { for (int i = 0; i < _multipleAudio.Count; i++) { if (!_multipleAudio[i].isPlaying) { AudioSourcePlayer player = _multipleAudio[i]; _multipleAudio.RemoveAt(i); i -= 1; player.Dispose(); } } }
protected void Awake() { sensor = GetComponentInChildren <Sensor>(); animator = GetComponentInChildren <Animator>(); CurrentHealth = maxHealth; maxHealthUpgrade = new CharacterUpgrade(); speedUpgrade = new CharacterUpgrade(); rateOfFireUpgrade = new CharacterUpgrade(); rangeUpgrade = new CharacterUpgrade(); damageUpgrade = new CharacterUpgrade(); projectileSpeedUpgrade = new CharacterUpgrade(); player = gameObject.AddComponent <AudioSourcePlayer>(); }
private void OnResult(UnityHttpClient httpClient, UnityHttpResponse response) { UnityHttpResponseAudioClip audioResp = (UnityHttpResponseAudioClip)response; AudioClip clip = audioResp.AudioClip; audioGameObject = new GameObject(); AudioSourcePlayer player = audioGameObject.AddComponent <AudioSourcePlayer>(); if (player) { player.AudioPlayCompleted.AddListener((AudioSourcePlayer p, EventArgs e) => { Destroy(audioGameObject); IntegrationTest.Pass(); }); player.PlayAudio(clip); } }
public bool canPlay = true; // Setup board and instantiate items // Setup board and instantiate items void BoardSetup() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); //Instantiate Board and set boardHolder to its transform. boardHolder = new GameObject("Board").transform; _items = new Item[width, height]; //Loop along x axis. for (int x = 0; x < width; x++) { //Loop along y axis for (int y = 0; y < height; y++) { _items[x, y] = InstantiateDoddle(x, y); } } }
private void Awake() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); }
protected override void OnAwake() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); }
private void Awake() { bouton = GetComponent <Button>(); player = gameObject.AddComponent <AudioSourcePlayer>(); }
private void OnAudioPlayCompleted(AudioSourcePlayer audioPlayer, EventArgs e) { IntegrationTest.Pass(gameObject); }
private void Awake() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); dialogTrigger = gameObject.GetComponent <DialogueTrigger>(); }
public void UnregisterAudioSourcePlayer(AudioSourcePlayer player) { soundSources.Remove(player); }
public void RegisterAudioSourcePlayer(AudioSourcePlayer player) { soundSources.Add(player); }