Exemple #1
0
 //========================================
 void Start()
 {
     Debug.Log("mainMenu start");
     if (SoundEnabler.getSoundState() != 0)
     {
         GetComponent <AudioSource>().Play();
     }
 }
Exemple #2
0
 //========================================
 public void playHitSound(float pitch)
 {
     hitSound.pitch = pitch;
     if (SoundEnabler.isSoundEnabled())
     {
         hitSound.Play();
     }
 }
Exemple #3
0
 //========================================
 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.
 }
Exemple #4
0
    //========================================
    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);
    }
Exemple #5
0
 //========================================
 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();
     }
 }