public void PlayBossMusic() { musicInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); musicInstance = RuntimeManager.CreateInstance(bossMusic); musicInstance.start(); }
public void Stop() { if (evt != null) { ERRCHECK(evt.stop()); } }
private void MusicChanger() { if (distance < minDistance) { startInstrumentalMusic = true; if (startBattleMusic == true) { print("battleMusic.start();"); instrumentalMusic.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); battleMusic.start(); startBattleMusic = false; } } else { startBattleMusic = true; if (startInstrumentalMusic == true) { print("instrumentalMusic.start();"); battleMusic.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); instrumentalMusic.start(); startInstrumentalMusic = false; } } }
void Update() { if (title) { transform.Translate(3 * Time.deltaTime, 0, 0); return; } transform.position = player.position + offset; targetZoom = Mathf.Lerp(zoomRange.x, zoomRange.y, Mathf.Clamp(player.GetComponent <Rigidbody2D>().velocity.magnitude / maxSpeed, 0, 1)); GetComponent <Camera>().orthographicSize = Mathf.Lerp(GetComponent <Camera>().orthographicSize, targetZoom, Time.deltaTime); if (portalCom.isActive) { musicInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); musicInstance.release(); } if (playerMovement.isDed) { delay += Time.deltaTime; if (delay >= 5) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } musicInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); musicInstance.release(); } }
public void ChangeState(State s) { if (s != _state) { _state = s; switch (_state) { case State.IDLE: _jumpInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); _WalkInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); break; case State.JUMP: _WalkInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); _jumpInstance.start(); break; case State.WALK: _WalkInstance.start(); _WalkInstance.setParameterValueByIndex(_velocityIndex, 0.5f); break; case State.RUN: _WalkInstance.start(); _WalkInstance.setParameterValueByIndex(_velocityIndex, 0.9f); break; default: break; } } }
void OnDestroy() { FMODmusic.setUserData(IntPtr.Zero); FMODmusic.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); FMODmusic.release(); timelineHandle.Free(); }
IEnumerator TapeStop() { IsStopping = true; FMODUnity.RuntimeManager.PlayOneShot(audioManager.cartridgeStop); float t = 0.0f; float targetT = playing.GetComponent <CartridgeData>().GetDataHolder().fadeOutTimeOnStop; float value; // if we're dividing by zero, skip the lerp and the math error if (targetT != t) { while (t < targetT) { t += Time.deltaTime; value = Mathf.Lerp(1, 0, t / targetT); playingTrack.setParameterValue("TapeStart", value); yield return(null); } } playingTrack.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); IsStopping = false; }
private void OnTriggerExit(Collider other) { hardNoise.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); softNoise.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); isSoftPlaying = false; isHardPlaying = false; }
/// <summary> /// Stops playback of the current song and starts playback of the song pointed to by 'songEvent'. /// </summary> public void PlaySong() { songEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); songEventInstance.release(); songEventInstance = FMODUnity.RuntimeManager.CreateInstance(songEvent); songEventInstance.start(); }
// Update is called once per frame void Update() { if (player.transform.position.x >= 9f) { stage3.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); } else if (player.HP <= 0) { stage3.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); } else if (boss.HP >= 101) { bosshp.setValue(1.0f); } else if (boss.HP >= 50) { bosshp.setValue(2.2f); } else if (boss.HP >= 2) { bosshp.setValue(3.2f); } else if (boss.HP <= 1) { bosshp.setValue(3.9f); } }
//state machine for lurker enemy private void StateMachine(EnemyStates state) { switch (state) { case EnemyStates.NULL: break; case EnemyStates.IDLE: idleInstance.start(); break; case EnemyStates.CHASEBAIT: targetTransform = bait.transform; EnemyMovement(); if (!playedAlertAudio) { idleInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); FMODUnity.RuntimeManager.PlayOneShotAttached(alertEvent, gameObject); playedAlertAudio = true; } break; case EnemyStates.ALERT: if (!playedAlertAudio) { idleInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); FMODUnity.RuntimeManager.PlayOneShotAttached(alertEvent, gameObject); playedAlertAudio = true; } break; case EnemyStates.CHASE: targetTransform = playerObject.transform; EnemyMovement(); break; case EnemyStates.ATTACK: targetTransform = null; Attack(); break; case EnemyStates.CONTENT: if (!isContent) { isContent = true; anim.SetBool("isContent", true); if (!playedContentAudio) { idleInstance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); Debug.Log("Played Content Audio"); FMODUnity.RuntimeManager.PlayOneShotAttached(contentEvent, gameObject); playedContentAudio = true; } } break; default: break; } }
public void PlayBGM(BGMSound bgm) { BGMSoundEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); BGMSoundEvent = FMODUnity.RuntimeManager.CreateInstance(BGMSounds[(int)bgm]); FMODUnity.RuntimeManager.AttachInstanceToGameObject(BGMSoundEvent, GetComponent <Transform>(), GetComponent <Rigidbody>()); BGMSoundEvent.start(); }
//Turns music on and off public void ToggleMusic(bool setMusic) { musicActive = setMusic; if (musicActive) { FMOD.Studio.PLAYBACK_STATE play_state; musicEvent.getPlaybackState(out play_state); if (play_state != FMOD.Studio.PLAYBACK_STATE.PLAYING) { musicEvent.start(); ConfigureAudio(); musicEvent.setTimelinePosition(timelinePosition); } } else { FMOD.Studio.PLAYBACK_STATE play_state; musicEvent.getPlaybackState(out play_state); if (play_state == FMOD.Studio.PLAYBACK_STATE.PLAYING) { musicEvent.getTimelinePosition(out timelinePosition); musicEvent.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); } } }
void movingState() { movingTime += Time.fixedDeltaTime; if (movingTime < 2f) { if (!moveu) { passosGorilaEv.start(); moveu = true; } anim.SetBool("Walk", true); rb.velocity = move; } else { passosGorilaEv.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); moveu = false; anim.SetBool("Walk", false); if (distancia < 6f && distancia > -6f) { currentState = 2; } else { movingCount++; movingTime = 0; currentState = 0; } } }
public void Stop() { if (evt != null) { ERRCHECK(evt.stop(STOP_MODE.IMMEDIATE)); } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.name == "Dresden") { if (collision.gameObject.GetComponent <Dresden>().Health < collision.gameObject.GetComponent <Dresden>().MAX_HEALTH) { if (!HealingBool) { HealingBool = true; HealInProgress.start(); } if (HealedBool) { HealedBool = false; HealComplete.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } collision.gameObject.GetComponent <Dresden>().Health += Time.deltaTime * 12; } else if (collision.gameObject.GetComponent <Dresden>().Health >= collision.gameObject.GetComponent <Dresden>().MAX_HEALTH) { collision.gameObject.GetComponent <Dresden>().Health = collision.gameObject.GetComponent <Dresden>().MAX_HEALTH; if (HealingBool) { HealingBool = false; HealInProgress.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } if (!HealedBool) { HealedBool = true; HealComplete.start(); } } } }
public void StopMusic() { if (play_state == FMOD.Studio.PLAYBACK_STATE.PLAYING) { musicEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); EventSystem.current.SetSelectedGameObject(null); } }
private void OnDestroy() { if (namePlateTransform) { Destroy(namePlateTransform.gameObject); } planetRoll.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); }
void ChangeSong() { music.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); music.release(); music = FMODUnity.RuntimeManager.CreateInstance(MusicEventList[songNum]); UpdateSongCredits(); FMODUnity.RuntimeManager.AttachInstanceToGameObject(music, GetComponent <Transform>(), GetComponent <Rigidbody>()); music.start(); }
void WinLevel() { gameEnded = true; menu.gameObject.SetActive(true); txtVictory.gameObject.SetActive(true); btnNext.gameObject.SetActive(true); musicInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); FMODUnity.RuntimeManager.PlayOneShot(WinEvent, transform.position); }
public void OnBlock() { m_Animator.SetBool(m_blockAnimBool, false); // Ends block animation. // Plays the sound for when the player successfully blocks an attack. FMODUnity.RuntimeManager.PlayOneShot(blockSFX, transform.position); blockingSFX_Instance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); // Stops blocking sound blockingSFX_Instance.release(); }
public void StopGameMusic1() { gameMusic1.getPlaybackState(out gameMusic1PlaybackState); if (gameMusic1PlaybackState == FMOD.Studio.PLAYBACK_STATE.PLAYING) { Debug.Log("Stop game music1"); gameMusic1.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } }
void OnDestroy() { if (chainEventInstance != null) { chainEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); chainEventInstance.release(); chainEventInstance = null; } }
private void Update() { if (consumesItem) { ConsumableItem consumableItem = itemOnSurface as ConsumableItem; if (amountOnSurface == numberNeeded && itemOnSurface == null) { amountOnSurface = 0; PlaceItemOnMe(Instantiate(itemToSpawn, positionOfItem.position, positionOfItem.rotation, transform)); } else if (consumableItem && consumableItem.canBeUsedFor == typeToConsume) { if (placeDownSound.Length != 0) { consumeItemSoundEvent = FMODUnity.RuntimeManager.CreateInstance(consumeItemSound); consumeItemSoundEvent.start(); } Debug.Log("Consume item"); Destroy(itemOnSurface.gameObject); itemOnSurface = null; amountOnSurface++; } textForConsumeables.text = amountOnSurface + "/" + numberNeeded; } if (itemOnSurface is UsableItem) { UsableItem item = itemOnSurface as UsableItem; if (item.percentageFull != 100 && hasItemOnCoroutine == null) { hasItemOnCoroutine = StartCoroutine(HasItemOnRoutine(item)); if (placeDownSound.Length != 0) { soundEvent = FMODUnity.RuntimeManager.CreateInstance(placeDownSound); soundEvent.start(); Debug.Log("Playing put down sound"); } } else if (item.percentageFull == 100 && hasItemOnCoroutine != null) { StopCoroutine(hasItemOnCoroutine); hasItemOnCoroutine = null; soundEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } } else if (hasItemOnCoroutine != null) { StopCoroutine(hasItemOnCoroutine); hasItemOnCoroutine = null; soundEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } }
private void OnTriggerExit2D(Collider2D collider) { if (collider.CompareTag(setTag)) { if (stopOnExit == true) { soundObject.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } } }
void movingState() { movingTime += Time.fixedDeltaTime; if (serrarCount < 2 && flameCount < 2) { if (movingTime < 2f) { if (!moveu) { passosSerraEv.start(); moveu = true; } anim.SetBool("Walk", true); rb.velocity = move; } else { passosSerraEv.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); moveu = false; anim.SetBool("Walk", false); walkCount++; movingTime = 0; currentState = 0; } } else { if (movingTime < 1f) { if (!moveu) { passosSerraEv.start(); moveu = true; } if (distancia < 10 && distancia > -10) { anim.SetBool("Walk", true); rb.velocity = -move; } } else { passosSerraEv.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); moveu = false; anim.SetBool("Walk", false); walkCount++; movingTime = 0; currentState = 4; } } }
private void OnTriggerStay(Collider other) { if (!PlayerIsWalking) { BushPushSound.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } else if (PlayerIsWalking && BushPushSoundPlaybackState != FMOD.Studio.PLAYBACK_STATE.PLAYING && BushPushSoundPlaybackState != FMOD.Studio.PLAYBACK_STATE.STARTING) { BushPushSound.start(); } }
private void OnBecameInvisible() { inCamera = false; if (isPlaying == true) { MovingEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); FMODUnity.RuntimeManager.DetachInstanceFromGameObject(MovingEvent); MovingEvent.release(); isPlaying = false; } }
// Update is called once per frame void Update() { if (!paused) { base.Update(); OrientSprite(); if (colorTicker >= 0.5f) { gameObject.GetComponentInChildren <SpriteRenderer>().color = Color.white; colorTicker = 0.0f; } if (gameObject.GetComponentInChildren <SpriteRenderer>().color == Color.red) { colorTicker += Time.deltaTime; } } if (health <= 0) { gameObject.GetComponentInChildren <SpriteRenderer>().color = Color.blue; SceneManager.LoadScene("Credits"); Camera.main.GetComponent <UIManager>().Game = false; return; } LowHealthSnap.setParameterByName("HP", health); if (ultimateForce.magnitude != 0) { runSprite.SetActive(true); idleSprite.SetActive(false); if (!triggered) { triggered = true; Footsteps.start(); } } else { runSprite.SetActive(false); idleSprite.SetActive(true); if (triggered) { triggered = false; Footsteps.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); } } }
private void InitializeTitleScreenAmbience() { cityMusicInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); cityMusicInstance.release(); homeMusicInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); thunderAmbianceInstance.setTimelinePosition(0); FMOD.Studio.ParameterInstance param; thunderAmbianceInstance.getParameter("Location", out param); param.setValue(0); thunderAmbianceInstance.start(); }
public static void StopEvent(EventInstance evt) { if (evt != null && evt.isValid()) { UnityUtil.ERRCHECK(evt.stop(STOP_MODE.ALLOWFADEOUT)); UnityUtil.ERRCHECK(evt.release()); } }