private void PlayHurtSound() { if (Health.health > 0) { TakeDamage?.Play(); } StartCoroutine(StopHurtSound()); }
private void Update() { if (!playerHealth.IsAlive()) { StopParticles(); } if (GameManager.Instance.GetInputFreeze()) { return; } if (Input.GetMouseButtonUp(0) && throwable == null && !thrown && !stopped) { throwable = InternalThrow(throwablePrefab); playerHealth.SetThrowable(throwable); if (!infinite) { thrown = true; } orb.gameObject.SetActive(false); aimTarget.SetActive(false); playerAnim.SetTrigger("Throw"); playerAnim.SetBool("Casting", false); startCastingParticles.Play(); castingParticles.Stop(); soundEmitter.SetParameter("Lanzar", 1); if (playingSound) { playingSound = false; } } else if (Input.GetMouseButtonUp(0) && throwable != null && !stopped) { throwable.Teleport(gameObject); playerHair.Teleport(); orb.Reset(); orb.Teleport(); playerAnim.SetTrigger("Appear"); appearParticles.Play(); movement.ClearForces(); movement.SetMovementScaleForTTime(movementScaleOnTeleport, timeToWaitOnTeleport); jump.SetGravityScaleForTTime(gravityScaleOnTeleport, timeToWaitOnTeleport); Destroy(throwable.gameObject); RuntimeManager.PlayOneShotAttached("event:/Teleport", this.gameObject); } else if (Input.GetMouseButtonDown(1) && throwable != null && !stopped) { orb.Reset(); Destroy(throwable.gameObject); throwable = null; RuntimeManager.PlayOneShotAttached("event:/recuperar orbe", this.gameObject); thrown = false; } else if (Input.GetMouseButton(0) && throwable == null && !thrown && !stopped) { orb.GetCloser(orbSpawn); aimTarget.SetActive(true); Vector3 direction = (Camera.main.ScreenToWorldPoint(Input.mousePosition) - orbSpawn.position); direction.z = 0; aimTarget.transform.position = orbSpawn.position + direction.normalized * aimOffset; aimTarget.transform.rotation = Quaternion.Euler(0.0f, 0.0f, Mathf.Rad2Deg * Mathf.Atan2(direction.y, direction.x)); playerAnim.SetBool("Casting", true); castingParticles.Play(); soundEmitter.Event = "event:/lanzamiento"; if (!playingSound) { soundEmitter.Stop(); } soundEmitter.SetParameter("Lanzar", 0); soundEmitter.OverrideAttenuation = true; soundEmitter.OverrideMaxDistance = 500; if (!playingSound) { playingSound = true; soundEmitter.Play(); } } else if (throwable == null && !thrown) { playerAnim.SetBool("Casting", false); if (playingSound) { playingSound = false; soundEmitter.Stop(); } //orb.Reset(); aimTarget.SetActive(false); castingParticles.Stop(); } if (throwable == null && thrown && groundDetector.IsGrounded()) { thrown = false; orb.Reset(); startCastingParticles.Stop(); castingParticles.Stop(); throwParticles.Stop(); appearParticles.Stop(); } stopped = Time.timeScale == 0; }
private void OnEnterSafeZone(SafeZoneHub hub) { enterSafeZoneSound.Play(); _surroundingEnergy = hub.Data.EmittingEnergy; Debug.Log("Entered safe zone"); }
public void Shoot() { soundEvent.Play(); fireParticle.SetActive(true); FreezeMonster(); }
public void PlayIntroSound() { intro.Play(); SuppressMusic(introSuppress); }
private void PlayExplosionSound() { Explosion?.Play(); StartCoroutine(StopExplosionSound()); }
private void PlayDeathSound() { Death?.Play(); StartCoroutine(StopDeathSound()); }
private void PlayHealthGainSound() { HealthGain?.Play(); StartCoroutine(StopHealthGainSound()); }
void Awake() { reverbSnapshotSwitcher_Indoor.Play(); reverbSnapshotSwitcher_Outdoor.Play(); }
IEnumerator PlayAudio() { SE.Play(); yield return(new WaitForSeconds(2)); }
public void StartGame() { SceneManager.LoadScene(1); menuButton.Play(); }
void Update() { if (_missionStarted) { if (_moveTimeRemain <= 0f) { _moving = !_moving; if (_moving) { _moveTimeRemain = moveTime.random; var dir = Random.insideUnitCircle; _velocity = moveSpeed.random * new Vector3(dir.x, 0, dir.y); } else { _moveTimeRemain = idleTime.random; _velocity = Vector3.zero; } } _moveTimeRemain -= Time.deltaTime; var player = GameContext.Instance.playerCtl; var dist = Vector3.Distance(player.transform.position, transform.position); if (dist > distanceThresh) { _outOfRangeTimer += Time.deltaTime; EventBus.Post(new GeneralHintEvent { msg = "<color=red>You are too far away from Jessica!</color>", forceOverride = true, overrideDuration = 0.3f, }); if (_outOfRangeTimer > loseTimeThresh) { EventBus.Post(new GeneralHintEvent { msg = "MISSION FAILED!", forceOverride = true, overrideDuration = 0.3f, }); _missionStarted = false; player.money = Mathf.Max(0, player.money - moneyPenalty.random); _inCD = true; } } else { EventBus.Post(new GeneralHintEvent { msg = $"Accompany Jessica for {accompanyTime} seconds", forceOverride = true, overrideDuration = 0.1f }); _outOfRangeTimer = 0f; _accompanyTimer += Time.deltaTime; if (_accompanyTimer >= accompanyTime) { EventBus.Post(new GeneralHintEvent { msg = $"Mission success!", forceOverride = true, }); _missionStarted = false; _accompanyTimer = 0f; player.money += moneyBonus.random; _coinSound.Play(); _inCD = true; } } } else { _moving = false; _velocity = Vector3.zero; } if (_inCD) { if (_interact.enabled) { _interact.enabled = false; } _cdTimer += Time.deltaTime; if (_cdTimer > cd) { _cdTimer = 0; _inCD = false; } } else if (!_missionStarted) { var shouldEnable = GameContext.Instance.playerCtl.money >= canBeginMoneyThresh; if (_interact.enabled != shouldEnable) { _interact.enabled = shouldEnable; } } }
public void TriggerMusic() { musicEvent.Play(); }
public static void PlayEvent(StudioEventEmitter audioEventEmitter) { audioEventEmitter.Play(); }
public void SetAndTriggerParam(float paramValue) { targetParam.SetParameter(relVelName, paramValue); targetParam.Play(); }
private void PlayBladeModeOffSound() { BladeModeOff?.Play(); StartCoroutine(StopBladeModeOffSound()); }
private void PlaySlashSound() { Slash?.Play(); }
private void PlayerDeath() { particles.Play(); soundEvent.Play(); }
private void PlayBoostSound() { Boost?.Play(); }
private void PlayDriftBoostSound() { DriftBoost?.Play(); }
private void PlayWallCollisionSound() { WallCollision?.Play(); }
private void PlayJumpChargeSound() { JumpCharge?.Play(); }
private void PlayCheckpointSoud() { Checkpoint?.Play(); StartCoroutine(StopCheckpointSound()); }
private void PlayJumpSound() { Jump?.Play(); StartCoroutine(StopJumpSound()); }
public void PlayOutroSound() { outro.Play(); SuppressMusic(outroSuppress); }
private void PlayJumpChargedSound() { JumpCharged?.Play(); StartCoroutine(StopJumpChargedSound()); }
public void QuitGame() { SEEE = GetComponent <StudioEventEmitter>(); SEEE.Play(); Application.Quit(); }
private void PlayKickSound() { Kick?.Play(); }
public void Play(Bundle parameters) { emitter?.Play(); }
//função para ser chamada quando o jogo termina e a telafinal deva ser acionada public void ActivateTelaFinal() { if (AlreadyEnded) { return; } Initialize(); AlreadyEnded = true; Time.timeScale = 0.0f; this.gameObject.SetActive(true); CharacterSelectionData csd = PersistentInfo.Instance.PlayerData; //ativa ou desativa paineis de acordo com o numero de jogadores jogando for (int i = 0; i < 4; i++) { characterPanels[i].SetActive(playersQtd > i); } //o primeiro painel é do player vitorioso List <int> orderedIndex = new List <int>(); for (int i = 0; i < playersQtd; i++) { orderedIndex.Add(i); } orderedIndex.Sort((i, j) => GameController.Instance.teamPoints[j].CompareTo(GameController.Instance.teamPoints[i])); for (int i = 0; i < playersQtd; i++) { //characterPanels[i].GetComponentInChildren<Text>().text = "Player " + (orderedIndex[i] + 1).ToString() + ": " + GameController.Instance.teamPoints[orderedIndex[i]].ToString(); if (i == 0) { characterPanels[i].GetComponentInChildren <Image>().sprite = sprites_vitoria[csd.CharSelected[orderedIndex[i]]]; } else { characterPanels[i].GetComponentInChildren <Image>().sprite = sprites_derrota[csd.CharSelected[orderedIndex[i]]]; } } //depois de setar as imagens e textos, ordena a hierarquia ao contrário pro primeiro lugar aparecer na frente dos demais for (int i = playersQtd - 1; i >= 0; i--) { characterPanels[i].transform.SetAsFirstSibling(); } //MasterBus.stopAllEvents(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); if (ambientacaoEmitter != null) { ambientacaoEmitter.Stop(); } if (vitoriaEmitter != null) { vitoriaEmitter.Play(); } else { Debug.Log("vitoria emiiter = null"); } }