Example #1
0
    public void ColliderOn(string type)
    {
        if (type == "coin")
        {
            SpawnOneMoney();
            SoundController.PlaySound(soundsGame.coin);
            addScore();
            sceneC.addSpeedToScene();
        }

        if (type == "bomb")
        {
            changeAnimationShip(false);
            SoundController.PlaySound(soundsGame.shipExplosion);
            gameC.setCurrentGameState(GameState.GAMEOVER);
            expo.SetActive(true);
        }
    }
Example #2
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "coin")
     {
         SoundController.PlaySound(soundsGame.loser);
         playerC.changeAnimationShip(false);
         gameC.setCurrentGameState(GameState.GAMEOVER);
     }
     if (coll.gameObject.tag == "bomb")
     {
         SoundController.PlaySound(soundsGame.bombDrop);
         int auxB = PlayerPrefs.GetInt("ptc_bombsDrown");
         auxB++;
         PlayerPrefs.SetInt("ptc_bombsDrown", auxB);
         showWaterDrop(new Vector3(coll.transform.position.x, -6.7f, 0f));
         coll.gameObject.SetActive(false);
         sceneC.addSpeedToScene();
     }
 }