// Update is called once per frame void Update() { Vector3 viewPos = cam.WorldToViewportPoint(grayTransform.position); if (viewPos.x < 0 || viewPos.y < 0 || viewPos.y > 1) { musicGO.Pause(); moveGrayScript.StopMoving(); moveCamScript.StopMoving(); loseScreen.SetActive(true); loseText.text = "Colors : " + colorScript.getColors() + "\nScore : " + scoreScript.getScore(); } }
void OnTriggerEnter(Collider col) { // if (col.gameObject.name == "3x1block" || col.gameObject.name == "1x1block") { // Debug.Log ("collision " + col.gameObject.name); // moveScript.enabled = false; // } Debug.Log("collision " + col.gameObject.name); if (col.gameObject.tag == "Drop") { dropGO.Play(); scoreScript.incrementScore(); Destroy(col.gameObject); } if (col.gameObject.tag == "Wall") { breakGO.Play(); colorScript.incrementColors(); musicScript.SwitchColors(colorScript.getColors()); //moveCamScript.IncrementSpeed(); //moveGrayScript.IncrementSpeed(); Destroy(col.gameObject); // END OF THE GAME if (col.gameObject.name == "Violet Wall") { musicGO.Pause(); moveGrayScript.StopMoving(); moveCamScript.StopMoving(); winScreen.SetActive(true); winText.text = "Colors : 7\nScore : " + scoreScript.getScore(); } } }
// Update is called once per frame void Update() { text.text = "Score: " + scoreScript.getScore(); }