public override void Interact() { if (!Progress.reference.finishedLaundry) { opening = true; } if (Progress.reference.hotWaterFixed && !Progress.reference.finishedLaundry) { Progress.reference.finishedLaundry = true; GlobalTime.reference.IncreaseTime(GLOBAL_TIME); doingLaundry.Play(); } else { needHotWater.Play(); } }
void Update() { switch (gameMode) { case 1: if (p1Paddle.activeSelf) { timeAlive += Time.deltaTime; timeAliveText.GetComponent <Text>().text = (int)timeAlive + " Sec. Alive"; } else { winnerText.text = "You survived for: " + (int)timeAlive + " Seconds!"; timeAliveText.text = ""; foreach (PingBall ball in balls) { ball.ResetBall(); } gameMode = 5; } p1HitPointsText.text = "P1 HP: " + p1HitPoints; break; case 2: if (!p2Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P1 Wins!"; pingWinPlayer.Play(); gameMode = 5; } else if (!p1Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P2 Wins!"; pingLosePlayer.Play(); gameMode = 5; } p1HitPointsText.text = "P1 HP: " + p1HitPoints; p2HitPointsText.text = "P2 HP: " + p2HitPoints; break; case 3: if (!p2Paddle.activeSelf && !p3Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P1 Wins!"; pingWinPlayer.Play(); gameMode = 5; } else if (!p1Paddle.activeSelf && !p3Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P2 Wins!"; pingLosePlayer.Play(); gameMode = 5; } else if (!p1Paddle.activeSelf && !p2Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P3 Wins!"; pingLosePlayer.Play(); gameMode = 5; } p1HitPointsText.text = "P1 HP: " + p1HitPoints; p2HitPointsText.text = "P2 HP: " + p2HitPoints; p3HitPointsText.text = "P3 HP: " + p3HitPoints; break; case 4: if (!p2Paddle.activeSelf && !p3Paddle.activeSelf && !p4Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P1 Wins!"; pingWinPlayer.Play(); gameMode = 5; } else if (!p1Paddle.activeSelf && !p3Paddle.activeSelf && !p2Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P2 Wins!"; pingLosePlayer.Play(); gameMode = 5; } else if (!p1Paddle.activeSelf && !p2Paddle.activeSelf && !p4Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P3 Wins!"; pingLosePlayer.Play(); gameMode = 5; } else if (!p1Paddle.activeSelf && !p2Paddle.activeSelf && !p3Paddle.activeSelf) { foreach (PingBall ball in balls) { ball.ResetBall(); } winnerText.text = "P4 Wins!"; pingLosePlayer.Play(); gameMode = 5; } p1HitPointsText.text = "P1 HP: " + p1HitPoints; p2HitPointsText.text = "P2 HP: " + p2HitPoints; p3HitPointsText.text = "P3 HP: " + p3HitPoints; p4HitPointsText.text = "P4 HP: " + p4HitPoints; break; case 5: p1HitPointsText.text = ""; p2HitPointsText.text = ""; p3HitPointsText.text = ""; p4HitPointsText.text = ""; if (endGameTimer >= 5f) { continuePanel.SetActive(true); yesButton.Select(); winnerText.text = ""; endGameTimer = 0f; gameMode = 0; } else { endGameTimer += Time.deltaTime; } break; } if (Input.GetKeyDown(KeyCode.Mouse0)) { if (firstButton.gameObject.activeSelf) { firstButton.Select(); } else { yesButton.Select(); } } }