// Called every frame void Update() { // Clear if we have multiple if (emoteButtons.Count > 1) { emoteButtons.Clear(); } // IF the trigger is pressed if (SteamVR_Actions._default.TriggerPress.GetStateDown(hand)) { // This is litrally disgusting, do not look bellow 😞 // If we are just interacting with exactly 1 button if (collidedButtons.Count == 1) { collidedButtons[0].PressButton(); // Go to the button script and do what it says try { GenericButton gb = (GenericButton)collidedButtons[0]; if (gb.GetSpecailSound() == "Outfit") { audioSorces[1].volume = ((PlayerPrefs.GetInt("MusicVol") + 10) / 10.0f) / 2f; audioSorces[1].Play(); //Debug.Log(audioSorces[1].clip.name + " Played at vol: " + audioSorces[1].volume); return; } } catch { try { CosmeticSelectionButton gb = (CosmeticSelectionButton)collidedButtons[0]; audioSorces[2].volume = ((PlayerPrefs.GetInt("MusicVol") + 10) / 10.0f) / 2f; audioSorces[2].Play(); //Debug.Log(audioSorces[2].clip.name + " Played at vol: " + audioSorces[2].volume); return; } catch { } } //audioSorce.pitch = Random.Range(.95f, 1.05f); audioSorces[0].volume = ((PlayerPrefs.GetInt("MusicVol") + 10) / 10.0f) / 4f; audioSorces[0].Play(); //Debug.Log(audioSorces[0].clip.name + " Played at vol: " + audioSorces[0].volume); } } // If the track pad is pressed (For emote selection) if (SteamVR_Actions._default.TrackPadPress.GetStateDown(hand)) { // If we are just interacting with exactly 1 button if (emoteButtons.Count == 1) { emoteButtons[0].PressButton(tPad.GetAxis(hand)); // Go to the button script and do what it says audioSorces[0].volume = ((PlayerPrefs.GetInt("MusicVol") + 10) / 10.0f) / 4f; audioSorces[0].Play(); } } }
// Start is called before the first frame update void Start() { alpha = 1; if (this.transform.Find("Sprite") != null) { spriteRend = this.transform.Find("Sprite").GetComponent <SpriteRenderer>(); } else { spriteRend = this.transform.parent.Find("Sprite").GetComponent <SpriteRenderer>(); } if (forceUnlock == true && lockedUnlockedGloves.Length < 1) { unlocked = true; descTexts[0].text = unlockedDescString; return; } button = this.GetComponent <CosmeticSelectionButton>(); boxCol = this.GetComponent <BoxCollider>(); if (displayProgress == true) { if (this.transform.Find("StatsOutOf") != null) { statOutOfText = this.transform.Find("StatsOutOf").GetComponent <TextMeshPro>(); } else { statOutOfText = this.transform.parent.Find("StatsOutOf").GetComponent <TextMeshPro>(); } } if (SteamManager.Initialized == true) { bool steamAch = false; SteamUserStats.GetAchievement(achivName, out steamAch); if (steamAch == true || forceUnlock == true) { unlocked = true; descTexts[0].text = unlockedDescString; if (button != null) { button.enabled = true; } if (displayProgress == true) { statOutOfText.text = statMax + "/" + statMax; } spriteRend.sprite = lockedUnlockedSprite[1]; lockedUnlockedGloves[0].SetActive(false); lockedUnlockedGloves[1].SetActive(true); } else { if (button != null) { button.enabled = false; } if (boxCol != null) { boxCol.enabled = false; } if (displayProgress == true) { statOutOfText.text = AchivmentAndStatControl.GetStat(assocaitedStat) + "/" + statMax; } spriteRend.sprite = lockedUnlockedSprite[0]; lockedUnlockedGloves[0].SetActive(true); lockedUnlockedGloves[1].SetActive(false); } } }