public static AudioCue PlaySound(AudioClip clip, Transform followTransform, AudioCue.CueSettings settings) { AudioCue cue = PlaySound(clip, followTransform.position, settings); cue.transform.parent = followTransform; return(cue); }
public static AudioCue GetActiveCue() { AudioCue cue = GetInactiveCue(); cue.SetActive(); return(cue); }
public void Start( ) { _baseColor = tileImage.color; tileImage.color = gameboardColor.value; if (constantValue == -1) { _value = 0; tileImage.color = _baseColor; tileText.text = ""; } else if (constantValue == 0) { _value = Random.Range(sharedMinTileValue.value, sharedMaxTileValue.value); } else { _value = constantValue; } if (constantValue != -1) { tileText.SetText(_value.ToString( )); } _positiveAudioCue = Resources.Load <AudioCue>("Audio/Positive"); }
public void PlayCue(AudioCue cue) { if (cue.clips.Length > 0) { AudioClip clip = cue.clips[random.Next(cue.clips.Length)]; source.PlayOneShot(clip); } }
public void SetMusic(AudioCue cue) { if (currentCue != cue) { currentCue = cue; currentCue.Play(audioSource); } }
internal static AudioCue CreateAudioCueFactoryAtPath(string path) { AudioCue asset = ScriptableObject.CreateInstance <AudioCue>(); asset.name = Path.GetFileName(path); AssetDatabase.CreateAsset(asset, path); return(asset); }
/// <summary> /// Stops the specified sound /// </summary> /// <param name="handle">The Handle of the sound to stop.</param> public void StopSound(AudioHandle handle) { AudioCue cue = m_cuePool.GetItem(handle); if (null != cue) { cue.m_cue.Stop(AudioStopOptions.AsAuthored); } }
/// <summary> /// Sets a user-defined variable for the sound /// </summary> /// <param name="handle">handle to the sound to set</param> /// <param name="varName">name of the variable to set</param> /// <param name="value">value of the variable to set</param> public void SetVariable(AudioHandle handle, string varName, float value) { AudioCue cue = m_cuePool.GetItem(handle); if (null != cue) { cue.m_cue.SetVariable(varName, value); } }
/// <summary> /// Updates a 3D sound with its latest emitter data /// </summary> /// <param name="handle">A handle to the sound being played</param> /// <param name="emitter">The emitter that contains the position and velocity data</param> public void UpdateSound3D(AudioHandle handle, AudioEmitter emitter) { AudioCue cue = m_cuePool.GetItem(handle); if (null != cue) { cue.m_cue.Apply3D(m_listener, emitter); } }
/// <summary> /// Check whether or not the specified sound is currently playing. /// </summary> /// <param name="handle">The Handle of the sound to stop.</param> /// <returns>true if the sound is currently playing</returns> public bool IsPlaying(AudioHandle handle) { AudioCue cue = m_cuePool.GetItem(handle); if (null != cue) { return(cue.m_cue.IsPlaying); } return(false); }
public void PlayCueAsset(AudioCue cue) { if (!DisableCues && CueSources.Length > cue.CueSourceIndex && CueSources[cue.CueSourceIndex] != null) { CueSources[cue.CueSourceIndex].Stop(); CueSources[cue.CueSourceIndex].PlayOneShot(cue.Clip); Get <SubtitleManager>().PlaySubtitles(cue.Subtitles); } }
private void OnCollisionEnter(Collision collision) { if (canKnock == false) { return; } Rigidbody rb = collision.gameObject.GetComponent <Rigidbody>(); if (rb != null) { Debug.Log("Bounce pad is colliding with player"); Vector3 knockBack = collision.GetContact(0).normal *knockBackForce; Debug.DrawLine(transform.position, transform.position + knockBack); if (audioPlayer == null) { audioPlayer = GetComponent <AudioCue>(); } if (audioPlayer != null) { audioPlayer.PlayAudioCue(); } Transform child = transform.GetChild(0); if (child != null) { child.DOPunchScale(child.localScale * scaleModifier, scaleDuration, 4, 1).SetEase(Ease.OutElastic); } rippleFX.Play(); rb.AddForce(knockBack, ForceMode.Impulse); canKnock = false; StartCoroutine(CoolDown()); } if (collision.gameObject.CompareTag("Player")) { if (impulse == null) { impulse = GetComponent <CinemachineImpulseSource>(); } if (impulse != null) { impulse.GenerateImpulse(knockBackForce / 10); Debug.Log("Generating Impulse"); } } }
public static AudioCue PlaySound(AudioClip clip, Vector3 location, AudioCue.CueSettings settings) { AudioCue cue = AudioCue.GetActiveCue(); cue.transform.position = location; cue.Settings = settings; cue.SetClip(clip); cue.Play(); return(cue); }
public void AssembleAnimation(UnitStateType state, UnitAsset asset) { m_asset = asset; m_state = state; m_pool = m_asset.ObjectPoolAsset(); m_deathFX = m_asset.DeathFX(); m_collisionFX = m_asset.CollisionFX(); m_camShakeEvent = m_asset.CamShakeEvent(); m_motorSFX = m_asset.MotorSFX(); m_mesh = m_asset.AddMeshToUnit(transform); }
/// <summary> /// /// </summary> /// <param name="audioCue"></param> /// <returns></returns> public int RegisterAudioCue(AudioCue audioCue) { for (int i = 0; i < audioCues.Count; i++) { if (string.Equals(audioCue.name, audioCues[i].name)) { return(i); } } audioCues.Add(audioCue); return(audioCues.Count - 1); }
private void InitializeAudioCues() { AudioCue[] audioCues = GetComponents <AudioCue>(); foreach (AudioCue audioCue in audioCues) { if (audioCue.Name == "Input Audio") { InputAudio = audioCue; } else if (audioCue.Name == "Output Audio") { OutputAudio = audioCue; } } }
private void Start() { audioCue = GetComponent <AudioCue>(); CollisionMap = new Dictionary <Material, CollisionData>(); foreach (CollisionData data in ImpactSounds) { if (data.mat == null) { continue; } CollisionMap.Add(data.mat, data); } }
/// <summary> /// Called each frame while this tile is selected (highlighted in UI). /// </summary> private void WhileHighlit() { if (previewLength > 0.0f) { previewSeconds += Time.WallClockFrameSeconds; if (previewSeconds > previewLength) { OnUnHighlight(); } } AudioCue cue = BokuGame.Audio.Play(upid, null, cues); if (cue != null) { cue.OnComplete += OnAudioCueComplete; } }
private void InitializeAudioCues() { AudioCue[] audioCues = GetComponents <AudioCue>(); foreach (AudioCue audioCue in audioCues) { if (audioCue.Name == "Card Drag Audio") { CardDragAudio = audioCue; } else if (audioCue.Name == "Card Drop Valid Audio") { CardDropValidAudio = audioCue; } else if (audioCue.Name == "Card Drop Invalid Audio") { CardDropInvalidAudio = audioCue; } } }
/// <summary> /// Allows the game component to update itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public override void Update(GameTime gameTime) { // Update the XACT engine. m_audioEngine.Update(); // Go through all the AudioCues looking for any that are finished #if AUDIO_DEBUG int numPlaying = 0; #endif for (UInt16 i = 0; i < MAX_AUDIO_CUE; ++i) { AudioHandle handle = m_cuePool.GetHandleByIndex(i); AudioCue cue = m_cuePool.GetItem(handle); if (null != cue) { // this cue is alive if (AudioCue.State.PLAYING == cue.m_state) { // it thinks it is playing if (false == cue.m_cue.IsPlaying) { // the sound isn't playing anymore - must have stopped cue.Free(); cue.m_state = AudioCue.State.AVAILABLE; m_cuePool.Free(handle); #if AUDIO_DEBUG --m_numPlaying; ++m_numStopped; } else { ++numPlaying; #endif } } } //if (null != cue) } //for (UInt16 i = 0; i < MAX_AUDIO_CUE; ++i) #if AUDIO_DEBUG System.Diagnostics.Debug.Assert(numPlaying == m_numPlaying); System.Diagnostics.Debug.Assert(numPlaying == m_numPlayed - m_numStopped); #endif base.Update(gameTime); }
private static AudioCue CreateNew() { if (!_audioCuePoolParent) { _audioCuePoolParent = new GameObject().transform; _audioCuePoolParent.name = "Audio Cue Pool"; DontDestroyOnLoad(_audioCuePoolParent); } GameObject newGameObject = new GameObject(); newGameObject.name = "Audio Cue"; newGameObject.SetActive(false); newGameObject.transform.parent = _audioCuePoolParent; AudioCue newCue = newGameObject.AddComponent <AudioCue>(); newCue.CreateAudioSource(); _inactiveAudioCues.Add(newCue); return(newCue); }
/// <summary> /// Attempts to play the sound. /// Returns a Handle to the AudioCue that gets played. /// </summary> /// <param name="soundName">The name of the sound to play.</param> public AudioHandle PlaySound(String soundName) { AudioHandle handle = m_cuePool.Allocate(); AudioCue cue = m_cuePool.GetItem(handle); if (null != cue) { System.Diagnostics.Debug.Assert(cue.m_state == AudioCue.State.AVAILABLE); System.Diagnostics.Debug.Assert(cue.m_cue == null); cue.SetUp(m_soundBank, soundName); cue.Play(); #if AUDIO_DEBUG ++m_numPlaying; ++m_numPlayed; } else { ++m_numFailed; #endif } return(handle); }
private void InitializeAudioCues() { AudioCue[] audioCues = GetComponents <AudioCue>(); foreach (AudioCue audioCue in audioCues) { if (audioCue.Name == "Instruction Drag Audio") { InstructionDragAudio = audioCue; } else if (audioCue.Name == "Instruction Drop Valid Audio") { InstructionDropValidAudio = audioCue; } } Transform content = this.transform.parent; Transform viewport = content.parent; Transform scrollView = viewport.parent; Transform window = scrollView.parent; InstructionDropInvalidAudio = window.GetComponent <AudioCue>(); }
public void Start( ) { playerScore.value = 0; _prevScore = 0; Vector3 worldToViewPort = Camera.main.WorldToViewportPoint(transform.position); worldToViewPort.y -= 0.4625f; lineStartRect.anchorMin = new Vector2(worldToViewPort.x, worldToViewPort.y); lineStartRect.anchorMax = new Vector2(worldToViewPort.x, worldToViewPort.y); lineStartRect.anchoredPosition = Vector2.zero; lineStartRect.DOAnchorPos(Vector2.zero, 0.25f); transform.localScale = new Vector3(0.28f, 0.28f, 1); _winAudioCue = Resources.Load <AudioCue>("Audio/Win"); _loseAudioCue = Resources.Load <AudioCue>("Audio/Lose"); GameAnalytics.NewProgressionEvent(GAProgressionStatus.Start, "game"); }
public void Start( ) { //textValue.GetComponent<Renderer>( ).sortingLayerName = "AboveDefault"; //textValue.SetText( "-" + negativeValue ); _negativeAudioCue = Resources.Load <AudioCue>("Audio/Negative"); if (!moving) { return; } Sequence s = DOTween.Sequence( ); s.AppendInterval(0.5f); s.Append(transform.DOMove(end, moveTime).SetEase(Ease.InOutCubic)); s.AppendInterval(0.5f); //s.Append( transform.DOMove( start, moveTime ).SetEase( Ease.InOutCubic ) ); //s.AppendInterval( 0.5f ); s.SetLoops(-1, LoopType.Yoyo); }
private void Start() { world = GetComponentInParent <MapRotation>(); audioPlayer = GetComponent <AudioCue>(); }
private void OnAudioCueComplete(AudioCue cue) { cues.Remove(cue); previewSeconds = 0.0f; }
public Song(AudioCue songCue) { SongCue = songCue; SongEventQueue = new List <SongEvent>(); }
public NamedAudioCue(string name) { this.name = name; cue = null; }
public NamedAudioCue(string name, AudioCue cue) { this.name = name; this.cue = cue; }