Пример #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Puck")
     {
         Puck puck   = collision.gameObject.GetComponent <Puck>();
         int  puckId = puck.GetId();
         //TODO If puck is different color from triggerOwner
         if (id != puckId)
         {
             GameManager.Instance.AddScore(puckId, puck.GetValue());
             if (!puck.specialPuck)
             {
                 SoundManager.instance.PlayGoalSFX();
             }
             else
             {
                 SoundManager.instance.PlayMaskedGoalSFX();
             }
         }
         GameObject.Destroy(collision.gameObject);
         GameManager.Instance.SpawnPuck(puckId);
     }
 }