Ejemplo n.º 1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        TagManager tagManager = collision.gameObject.GetComponent <TagManager>();

        GetComponent <AudioSource>().Play();

        if (tagManager == null)
        {
            return;
        }
        Tag myTag = tagManager.myTag;

        if (myTag.Equals(Tag.SOL_DUVAR))
        {
            //sag player skor yapar
            rightRacket.MakeScore();
        }
        else if (myTag.Equals(Tag.SAG_DUVAR))
        {
            //sol player skor yapar
            leftRacket.MakeScore();
        }
        if (myTag.Equals(Tag.SAG_RAKET))
        {
            DonusYonHesapla(collision, -1);
        }
        else if (myTag.Equals(Tag.SOL_RAKET))
        {
            DonusYonHesapla(collision, 1);
        }
    }
Ejemplo n.º 2
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     audioSource.Play();
     if (collision.gameObject.tag == "leftWall")
     {
         rightRacket.MakeScore();
     }
     if (collision.gameObject.tag == "rightWall")
     {
         leftRacket.MakeScore();
     }
     if (collision.gameObject.tag == "rightRacket")
     {
         CalculateReturnVelocity(-1, collision);
     }
     if (collision.gameObject.tag == "leftRacket")
     {
         CalculateReturnVelocity(1, collision);
     }
 }