//======================================== void Start() { Debug.Log("mainMenu start"); if (SoundEnabler.getSoundState() != 0) { GetComponent <AudioSource>().Play(); } }
//======================================== public void playHitSound(float pitch) { hitSound.pitch = pitch; if (SoundEnabler.isSoundEnabled()) { hitSound.Play(); } }
//======================================== public void onGameOver() { Debug.Log("game over"); resultsText.text = "Game Over." + "\r\nGoals = " + destroyedBlocks + " / " + totalBlocks; if (SoundEnabler.isSoundEnabled()) { gameOverSound.Play(); } Invoke("showResultsWindow", 0.25f); //reaction delay - realize what's happened. }
//======================================== private void init() { rnd = new System.Random(); var rect = actionCanvas.GetComponent <RectTransform>().rect; appWidth = rect.width; appHeight = rect.height; Debug.Log("appSize = " + appWidth + "x" + appHeight); Debug.Log("sound = " + SoundEnabler.isSoundEnabled()); resultsWindow.SetActive(false); }
//======================================== public void onBlockDestroy(Collision2D block) { destroyedBlocks++; if (destroyedBlocks < totalBlocks) { playHitSound(0.5f); //TODO: particle effects, show counter or smth else. } else { if (SoundEnabler.isSoundEnabled()) { winSound.Play(); } onWin(); } }