// Update is called once per frame void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.layer == 12) { ScoreTracker.AddPoint(points); } }
IEnumerator intro() { yield return(new WaitForSeconds(1)); aintro.SetActive(true); yield return(new WaitForSeconds(5)); aintro.SetActive(false); Camera.main.transform.position = ccamera.transform.position; Camera.main.transform.rotation = ccamera.transform.rotation; Instantiate(player, start.transform.position, start.transform.rotation); pintro1.SetActive(true); yield return(new WaitForSeconds(3)); pintro1.SetActive(false); yield return(new WaitForSeconds(3)); pintro2.SetActive(true); yield return(new WaitForSeconds(3)); pintro2.SetActive(false); Camera.main.transform.position = tvcamera.transform.position; Camera.main.transform.rotation = tvcamera.transform.rotation; q1.SetActive(true); q1a1.SetActive(true); q1a2.SetActive(true); q1a3.SetActive(true); q1a4.SetActive(true); yield return(new WaitForSeconds(10)); q1.SetActive(false); q1a1.SetActive(false); q1a2.SetActive(false); q1a3.SetActive(false); q1a4.SetActive(false); Camera.main.transform.position = acamera.transform.position; Camera.main.transform.rotation = acamera.transform.rotation; aint1.SetActive(true); yield return(new WaitForSeconds(3)); aint1.SetActive(false); Camera.main.transform.position = ccamera.transform.position; Camera.main.transform.rotation = ccamera.transform.rotation; pint1.SetActive(true); yield return(new WaitForSeconds(3)); if (choice == answer1) { player.transform.position = bottom.transform.position; points++; scoreTracker.AddPoint(1); } choice = 0; pint1.SetActive(false); yield return(new WaitForSeconds(3)); pint2.SetActive(true); yield return(new WaitForSeconds(3)); pint2.SetActive(false); Camera.main.transform.position = tvcamera.transform.position; Camera.main.transform.rotation = tvcamera.transform.rotation; a1.SetActive(true); yield return(new WaitForSeconds(3)); a1.SetActive(false); tvint1.SetActive(true); yield return(new WaitForSeconds(3)); tvint1.SetActive(false); q2.SetActive(true); q2a1.SetActive(true); q2a2.SetActive(true); q2a3.SetActive(true); q2a4.SetActive(true); yield return(new WaitForSeconds(10)); q2a1.SetActive(false); q2a2.SetActive(false); q2a3.SetActive(false); q2a4.SetActive(false); q2.SetActive(false); Camera.main.transform.position = acamera.transform.position; Camera.main.transform.rotation = acamera.transform.rotation; aint1.SetActive(true); yield return(new WaitForSeconds(3)); aint1.SetActive(false); Camera.main.transform.position = ccamera.transform.position; Camera.main.transform.rotation = ccamera.transform.rotation; pint1.SetActive(true); yield return(new WaitForSeconds(3)); pint1.SetActive(false); if (choice == answer2) { if (points == 0) { player.transform.position = bottom.transform.position; } else if (points == 1) { player.transform.position = middle.transform.position; } points++; scoreTracker.AddPoint(1); } choice = 0; yield return(new WaitForSeconds(3)); pint22.SetActive(true); yield return(new WaitForSeconds(3)); pint22.SetActive(false); Camera.main.transform.position = tvcamera.transform.position; Camera.main.transform.rotation = tvcamera.transform.rotation; a2.SetActive(true); yield return(new WaitForSeconds(3)); a2.SetActive(false); tvint2.SetActive(true); yield return(new WaitForSeconds(3)); tvint2.SetActive(false); q3.SetActive(true); q3a1.SetActive(true); q3a2.SetActive(true); q3a3.SetActive(true); q3a4.SetActive(true); yield return(new WaitForSeconds(10)); q3a1.SetActive(false); q3a2.SetActive(false); q3a3.SetActive(false); q3a4.SetActive(false); q3.SetActive(false); Camera.main.transform.position = acamera.transform.position; Camera.main.transform.rotation = acamera.transform.rotation; aint1.SetActive(true); yield return(new WaitForSeconds(3)); aint1.SetActive(false); Camera.main.transform.position = ccamera.transform.position; Camera.main.transform.rotation = ccamera.transform.rotation; pint1.SetActive(true); yield return(new WaitForSeconds(3)); pint1.SetActive(false); if (choice == answer3) { if (points == 0) { player.transform.position = bottom.transform.position; } else if (points == 1) { player.transform.position = middle.transform.position; } else if (points == 2) { Destroy(fish); player.transform.position = top.transform.position; } points++; scoreTracker.AddPoint(1); } choice = 0; yield return(new WaitForSeconds(3)); pint32.SetActive(true); yield return(new WaitForSeconds(3)); pint32.SetActive(false); a3.SetActive(true); Camera.main.transform.position = tvcamera.transform.position; Camera.main.transform.rotation = tvcamera.transform.rotation; yield return(new WaitForSeconds(3)); a3.SetActive(false); Camera.main.transform.position = acamera.transform.position; Camera.main.transform.rotation = acamera.transform.rotation; afinale.SetActive(true); yield return(new WaitForSeconds(3)); afinale.SetActive(false); Camera.main.transform.position = ccamera.transform.position; Camera.main.transform.rotation = ccamera.transform.rotation; }
private void OnCollisionEnter(Collision collision) { scoreManager.AddPoint(pointAmount); }