private void OnCollisionEnter2D(Collision2D collision) { PlayHitParticleAccordingToCollission(collision); if (collision.collider.tag == "raquette") { AudioManagerForOneGame.am.PlaySound("pongHitPaddle"); camShake.AskLittleShake(); CalculateNewTrajectory(collision); } else if (collision.collider.tag == "but") { AudioManagerForOneGame.am.PlaySound("pongHitWall"); camShake.AskShake(); rb.velocity = Vector2.zero; StartCoroutine("Goal"); } else { AudioManagerForOneGame.am.PlaySound("pongHitWall"); } }
public void OnTouch() { if (canTouch && !AbstractMenu.Paused) { if (fruitHolder.actualFruit == targetFruit.GetComponent <Image>().sprite) { Points++; AudioManagerForOneGame.am.PlaySound("goodChoice"); targetFruit.GetComponent <TargetFruitController>().ReactToGoodAnswer(); if (!colorChanging) { colorCouroutine = StartCoroutine(changeColorAnswer(new Color32(134, 255, 151, 255))); } else { StopCoroutine(colorCouroutine); colorCouroutine = StartCoroutine(changeColorAnswer(new Color32(134, 255, 151, 255))); } } else { AudioManagerForOneGame.am.PlaySound("badChoice"); Points--; cameraShake.AskShake(); if (!colorChanging) { colorCouroutine = StartCoroutine(changeColorAnswer(new Color32(255, 121, 121, 255))); } else { StopCoroutine(colorCouroutine); colorCouroutine = StartCoroutine(changeColorAnswer(new Color32(255, 121, 121, 255))); } } } }