예제 #1
0
 /// <summary>
 /// Called when [trigger enter2 d].
 /// Gestiona la perdida de escudo al chocar con una bola y al perder la partida
 /// </summary>
 /// <param name="collision">The collision.</param>
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (GameManager.inGame && !FreezeManager.fm.freeze)
     {
         if (collision.gameObject.tag == "Ball")
         {
             if (shield.activeInHierarchy)
             {
                 shield.SetActive(false);
                 General.Audio(fuenteAudio, escudoSonido);
                 StartCoroutine(IEBlinking());
             }
             else
             {
                 if (!blink)
                 {
                     General.Audio(fuenteAudio, escudoSonido);
                     StartCoroutine(IELose());
                 }
             }
         }
         if (!GameManager.inGame && (collision.gameObject.tag == "Right" || collision.gameObject.tag == "Left"))
         {
             sr.flipX     = !sr.flipX;
             rb.velocity /= 3;
             rb.velocity *= -1;
             rb.AddForce(Vector3.up * 5, ForceMode2D.Impulse);
         }
     }
 }
예제 #2
0
    /// <summary>
    /// Instantiantes the price.
    /// Genera el item de premio en la explosion de la bola
    /// </summary>
    private void InstantiantePrice()
    {
        int aleatory = BallManager.bm.AleatoryNumber();

        if (aleatory == 1)
        {
            Instantiate(powerUp, transform.position, Quaternion.identity);
            General.Audio(fuenteAudio, itemSonido);
        }
    }
예제 #3
0
파일: FruitItem.cs 프로젝트: AlbertoVf/Pang
    /// <summary>
    /// Called when [trigger enter2 d].
    /// Comprueba si el item colisiona con el suelo o con un elemento que lo destruya y consiga puntos.
    /// </summary>
    /// <param name="collision">The collision.</param>
    private void OnTriggerEnter2D(Collider2D collision)
    {
        General.Audio(fuenteAudio, itemSonido);
        if (collision.gameObject.tag == "Ground")
        {
            inGround = true;
            Destroy(gameObject, Tiempo.ITEMSUELO);
        }
        else if (collision.gameObject.tag == "Player" || collision.gameObject.tag == "Arrow" || collision.gameObject.tag == "Ancle")
        {
            int score = Puntuacion.FRUIT;
            ScoreManager.sm.UpdateScore(score);

            PopUpManager.pm.InstanciatePopUpText(transform.position, score);
            GameManager.gm.fruitsCatched++;
            Destroy(gameObject);
        }
    }
예제 #4
0
 public void SonidoExplosion()
 {
     General.Audio(fuenteAudio, explosion);
 }