ChangeVolume() public method

public ChangeVolume ( float newVolume ) : void
newVolume float
return void
Ejemplo n.º 1
0
 public void LoadLevel(int index)
 {
     if (index == 1)
     {
         AudioController.ChangeVolume("Movement", PlayerPrefs.GetFloat("volume") * 0.4f);
     }
     SceneManager.LoadScene(index);
 }
Ejemplo n.º 2
0
 private void OnCollisionExit2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "crate")
     {
         checkCrate = false;
         pushing    = false;
         AudioController.ChangeVolume("PushBox", 0);
     }
 }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     lives = playerController.lives;
     size  = Mathf.Clamp(playerController.size, 0, 500);
     if (size == 500)
     {
         PlayerPrefs.SetFloat("seconds", Mathf.Round((Time.time - timer) * 10) / 10f);
         AudioController.ChangeVolume("Movement", 0);
         SceneLoader.Victory();
     }
     UpdateUI();
 }
Ejemplo n.º 4
0
 public void LoadNextLevel()
 {
     // Debug.Log(thisIndex);
     AudioController.ChangeVolume("Movement", PlayerPrefs.GetFloat("volume") * 0.4f);
     if (thisIndex < SceneManager.sceneCountInBuildSettings - 1)
     {
         LoadLevel(thisIndex + 1);
     }
     else
     {
         // Debug.Log(SceneManager.sceneCountInBuildSettings);
         LoadLevel(0);
     }
 }
Ejemplo n.º 5
0
 public void UpdateUI()
 {
     if (lives > 0)
     {
         healthbar.GetComponent <Image>().sprite = livesStates[lives - 1];
     }
     else
     {
         Color trans = new Color(0, 0, 0, 0);
         healthbar.GetComponent <Image>().color = trans;
         PlayerPrefs.SetFloat("size", size / 5f);
         AudioController.ChangeVolume("Movement", 0);
         SceneLoader.GameOver();
     }
     bar.gameObject.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Mathf.Lerp(bar.gameObject.GetComponent <RectTransform>().rect.width, size, Time.deltaTime * 10));
 }
Ejemplo n.º 6
0
 void checkPush(GameObject crate)
 {
     if (Mathf.Abs(crate.GetComponent <Rigidbody2D>().velocity.x) > 0.5f)
     {
         if (!pushing)
         {
             AudioController.PlaySound("PushBox");
             AudioController.ChangeVolume("PushBox", PlayerPrefs.GetFloat("SoundVolume", 1));
             pushing = true;
         }
     }
     else
     {
         AudioController.ChangeVolume("PushBox", 0);
         pushing = false;
     }
 }
Ejemplo n.º 7
0
    void AdjustDynamicVolume()
    {
        if (tileSwitch == null)
        {
            return;
        }
        var soundVolume = PlayerPrefs.GetFloat("SoundVolume", 1);
        var closest     = tileSwitch.activeTileSet == 0 ? DistanceToNearest(waterTiles) : DistanceToNearest(lavaTiles);

        if (tileSwitch.activeTileSet == 0)
        {
            AudioController.ChangeVolume("Water", Mathf.Clamp(1f / closest, 0, 1) * soundVolume);
            AudioController.ChangeVolume("Lava", 0f);
        }
        else
        {
            AudioController.ChangeVolume("Lava", Mathf.Clamp(1f / closest, 0, 1) * soundVolume);
            AudioController.ChangeVolume("Water", 0f);
        }
    }
Ejemplo n.º 8
0
    void Start()
    {
        if (mainMenu)
        {
            volume.value = PlayerPrefs.GetFloat("volume", 1);
            AudioController.ChangeVolume("Soundtrack", PlayerPrefs.GetFloat("volume"));
        }

        screenHeight = Camera.main.orthographicSize * 2;
        screenWidth  = screenHeight / Screen.height * Screen.width;
        lastTime     = Time.time;

        if (optionalGameOverText != null)
        {
            optionalGameOverText.text = "You managed to reach a total size of " + PlayerPrefs.GetFloat("size", 0) + "% of the observable universe";
        }

        if (optionalVictoryText != null)
        {
            optionalVictoryText.text = "You destroyed the entire observable universe in just " + PlayerPrefs.GetFloat("seconds", 0) + " seconds!";
        }
    }
Ejemplo n.º 9
0
 public void ModifyVolume()
 {
     PlayerPrefs.SetFloat("volume", volume.value);
     AudioController.ChangeVolume("Soundtrack", PlayerPrefs.GetFloat("volume"));
 }