//Use this for the actual interactions. "co" refers to the color of the face it just intersected public void ColorEffect(string co) { // Blue extinguishes red, red burns green, and green absorbs blue if ((color == "red" & co == "blue") | (color == "green" & co == "red") | (color == "blue" & co == "green")) { SetColor("grey"); } // If the color of the terrain is red and it isn't blue, the player dies else if (color == "red" & co != "blue") { ScoreManager.Instance.Score -= 20; gameover.Setup(ScoreManager.Instance.Score); } // Grey never replaces a color else if (co == "grey") { SetColor(color); } // If no interaction takes place, just change the color of the tile else { SetColor(co); } }
// Update is called once per frame void Update() { if (player.transform.position.y <= .10) { hasfallen += 1; if (hasfallen == 1) { ScoreManager.Instance.Score -= 20; } GameOverScreen.Setup(ScoreManager.Instance.Score); } }
void Update() { if (connected) { Vector3 direction = player.position - transform.position + Vector3.up; Ray ray = new Ray(transform.position, direction); RaycastHit raycastHit; if (Physics.Raycast(ray, out raycastHit)) { if (raycastHit.collider.transform == player) { victoryscreen.Setup(ScoreManager.Instance.Score); } } } }