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