void OnTriggerEnter2D(Collider2D other) { // TODO: find a cleaner way to prevent goal from marking itself if (other.transform.tag == "Puck") { if (other.transform.parent == null || (other.transform.parent.parent != null && other.transform.parent.parent.tag != "GoalKeeper")) { matchInfo.AddScore(1, opponentTeam); audio.PlayOneShot(hornClip); // TODO: optimization here if (Random.Range(0, 4) == 0) { GameObject.Find("Level/Public").audio.PlayOneShot(crowdSound); } other.rigidbody2D.isKinematic = true; faceOff.MakeFaceOff(); } } }
void OnTriggerStay(Collider other) { faceOff.MakeFaceOff(); }