private IEnumerator DeactivateSource(int intensity) { float startTime = Time.time; AudioSource source = null; switch (intensity) { case SAFE: source = safeSource; break; case DANGER: source = dangerSource; break; case CHASE: source = chaseSource; break; } if (source == null) { yield return(null); } else { float volumePercentage = 1f; while (volumePercentage > 0f) { volumePercentage = 1f - Mathf.Min(Time.time - startTime, 1f); source.volume = volumePercentage * ControlBindingContainer.GetInstance().musicVolume; yield return(null); } } }
public void OpenSettingsPanel() { startPanel.SetActive(false); connectPanel.SetActive(false); settingsPanel.SetActive(true); progressLabel.SetActive(false); ControlBindingContainer container = ControlBindingContainer.GetInstance(); musicSlider.minValue = 0f; musicSlider.maxValue = 1f; musicSlider.value = container.musicVolume; effectSlider.minValue = 0f; effectSlider.maxValue = 1f; effectSlider.value = container.effectVolume; keyboardUp.GetComponentInChildren <Text>().text = container.upKey.ToString(); keyboardDown.GetComponentInChildren <Text>().text = container.downKey.ToString(); keyboardLeft.GetComponentInChildren <Text>().text = container.leftKey.ToString(); keyboardRight.GetComponentInChildren <Text>().text = container.rightKey.ToString(); keyboardJump.GetComponentInChildren <Text>().text = container.jumpKey.ToString(); keyboardAction.GetComponentInChildren <Text>().text = container.actionKey.ToString(); keyboardLight.GetComponentInChildren <Text>().text = container.lightKey.ToString(); keyboardCling.GetComponentInChildren <Text>().text = container.clingKey.ToString(); }
public void LoadVolume() { if (isPlaying) { source.volume = ControlBindingContainer.GetInstance().musicVolume; } }
public void Awake() { gameManager = FindObjectOfType <GeneratedGameManager>(); isExplorer = PlayerStateContainer.Instance.TeamSelection == PlayerStateContainer.EXPLORER; musicIntensity = SAFE; safeSource.volume = ControlBindingContainer.GetInstance().musicVolume; dangerSource.volume = 0f; chaseSource.volume = 0f; }
private void CheckForRebinds() { Key selectedKey = Key.None; foreach (KeyCode keyCode in Enum.GetValues(typeof(KeyCode))) { if (keyCode != KeyCode.Escape && Input.GetKeyDown(keyCode)) { selectedKey = Array.Find(KeyInfo.KeyList, keyInfo => Array.Exists(keyInfo.keyCodes, containedCode => containedCode == keyCode)).Key; } } if (selectedKey != Key.None) { switch (inputRebinding) { case UP: ControlBindingContainer.GetInstance().upKey = selectedKey; break; case DOWN: ControlBindingContainer.GetInstance().downKey = selectedKey; break; case LEFT: ControlBindingContainer.GetInstance().leftKey = selectedKey; break; case RIGHT: ControlBindingContainer.GetInstance().rightKey = selectedKey; break; case JUMP: ControlBindingContainer.GetInstance().jumpKey = selectedKey; break; case ACTION: ControlBindingContainer.GetInstance().actionKey = selectedKey; break; case LIGHT: ControlBindingContainer.GetInstance().lightKey = selectedKey; break; case CLING: ControlBindingContainer.GetInstance().clingKey = selectedKey; break; } ControlBindingContainer.SaveInstance(); isRebinding = false; InitializePanel(); if (inputManager != null) { inputManager.ResetActionSet(); } } }
public void SetVolume() { ControlBindingContainer.GetInstance().musicVolume = musicSlider.value; ControlBindingContainer.SaveInstance(); lobbyMusicBehavior.LoadVolume(); if (musicManager != null) { musicManager.ResetMusicVolume(); } }
private void HandleSound() { if (currentCharges > 0) { soundSource.volume = ControlBindingContainer.GetInstance().effectVolume; } else { soundSource.volume = 0f; } }
private void ExplodeIfAble() { if (explosionTime != 0f) return; Collider2D[] triggers = Physics2D.OverlapCircleAll(transform.position, explosionTriggerRadius, whatIsExplosionTrigger); if (triggers.Length != 0) { explosionTime = Time.time; animator.SetBool("IsExploding", true); explosionSource.volume = ControlBindingContainer.GetInstance().effectVolume * 1.3f; explosionSource.Play(); } }
public void PlayLitSound() { victorySource.volume = ControlBindingContainer.GetInstance().effectVolume * 0.4f; defeatSource.volume = victorySource.volume; if (PlayerStateContainer.Instance.TeamSelection == PlayerStateContainer.NIGHTMARE) { defeatSource.Play(); } else { victorySource.Play(); } }
private void ResetVolume() { float volume = ControlBindingContainer.GetInstance().effectVolume; if (volume != lastVolume) { jumpSource.volume = volume * 0.15f; doubleJumpSource.volume = volume * 0.15f; dashSource.volume = volume * 0.4f; hitSource.volume = volume * 0.6f; deathSource.volume = volume * 0.5f; relightSource.volume = volume * 0.5f; lastVolume = volume; } }
public void PlaySound(bool nightmaresWon) { soundSource.volume = ControlBindingContainer.GetInstance().effectVolume * 0.4f; if (nightmaresWon && PlayerStateContainer.Instance.TeamSelection == PlayerStateContainer.NIGHTMARE) { soundSource.Play(); } else if (!nightmaresWon && PlayerStateContainer.Instance.TeamSelection == PlayerStateContainer.EXPLORER) { soundSource.Play(); } else if (PlayerStateContainer.Instance.TeamSelection == PlayerStateContainer.OBSERVER) { soundSource.Play(); } }
public void ResetMusicVolume() { switch (musicIntensity) { case SAFE: safeSource.volume = ControlBindingContainer.GetInstance().musicVolume; break; case DANGER: dangerSource.volume = ControlBindingContainer.GetInstance().musicVolume; break; case CHASE: chaseSource.volume = ControlBindingContainer.GetInstance().musicVolume; break; } }
public void InitializePanel() { ControlBindingContainer container = ControlBindingContainer.GetInstance(); musicSlider.minValue = 0f; musicSlider.maxValue = 1f; musicSlider.value = container.musicVolume; effectSlider.minValue = 0f; effectSlider.maxValue = 1f; effectSlider.value = container.effectVolume; keyboardUp.GetComponentInChildren <Text>().text = container.upKey.ToString(); keyboardDown.GetComponentInChildren <Text>().text = container.downKey.ToString(); keyboardLeft.GetComponentInChildren <Text>().text = container.leftKey.ToString(); keyboardRight.GetComponentInChildren <Text>().text = container.rightKey.ToString(); keyboardJump.GetComponentInChildren <Text>().text = container.jumpKey.ToString(); keyboardAction.GetComponentInChildren <Text>().text = container.actionKey.ToString(); keyboardLight.GetComponentInChildren <Text>().text = container.lightKey.ToString(); keyboardCling.GetComponentInChildren <Text>().text = container.clingKey.ToString(); }
public void LaunchIceBall(Vector3 mouseDirection) { float usableAttackCooldown = HasPowerup(Powerup.HALF_ABILITY_COOLDOWN) ? fireballCooldown / 2f : fireballCooldown; usableAttackCooldown *= 1.0f - (talentRanks[TalentEnum.ATTACK_COOLDOWN] * 0.05f); if (Time.time - fireballTime < usableAttackCooldown) { return; } if (photonView.isMine) { fireballTime = Time.time; IceBallBehavior iceBall = PhotonNetwork.Instantiate( fireballPrefab.name, new Vector3(transform.position.x, transform.position.y + 0.5f), Quaternion.identity, 0) .GetComponent <IceBallBehavior>(); Vector3 direction = mouseDirection.magnitude == 0f ? currentControllerState : mouseDirection; iceBall.SetStartingDirection(direction, fireballSpeed * GetSigmoidUpgradeMultiplier(1f, 1.7f), true); iceBall.CryoLauncherBehavior = this; launchSource.volume = ControlBindingContainer.GetInstance().effectVolume * 1.3f; launchSource.Play(); photonView.RPC("PlayLaunchSound", PhotonTargets.Others); } }
public void SetVolume() { ControlBindingContainer.GetInstance().musicVolume = musicSlider.value; ControlBindingContainer.SaveInstance(); lobbyMusicBehavior.LoadVolume(); }
public void ResetActionSet() { actionSet = ControlBindingContainer.GetInstance().GetActionSet(); }
public void SetEffectVolume() { ControlBindingContainer.GetInstance().effectVolume = effectSlider.value; ControlBindingContainer.SaveInstance(); }
public void PlayLaunchSound() { launchSource.volume = ControlBindingContainer.GetInstance().effectVolume * 1.3f; launchSource.Play(); }