From 3a313944b1d141491c5f202f43e1c69a1ebcc7a8 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 11 Apr 2023 19:59:42 -0400 Subject: [PATCH] option for explicit unlocking --- namedropper/Assets/Scripts/Game.cs | 1 + namedropper/Assets/Scripts/GameManager.cs | 1 + namedropper/Assets/Scripts/GameOverScreen.cs | 15 +++++-- namedropper/Assets/Scripts/Player.cs | 10 ++++- namedropper/Assets/Scripts/TopicSelect.cs | 46 ++++++++++++++++---- 5 files changed, 60 insertions(+), 13 deletions(-) diff --git a/namedropper/Assets/Scripts/Game.cs b/namedropper/Assets/Scripts/Game.cs index d7d81d7..eba1f47 100644 --- a/namedropper/Assets/Scripts/Game.cs +++ b/namedropper/Assets/Scripts/Game.cs @@ -7,6 +7,7 @@ using UnityEngine.SceneManagement; public class Game : Level { public const bool USE_MVP = true; + public const bool USE_UNLOCK = false; const bool HIDE_SCORES = true; int _seconds = 70; diff --git a/namedropper/Assets/Scripts/GameManager.cs b/namedropper/Assets/Scripts/GameManager.cs index d458a08..8dcec2c 100644 --- a/namedropper/Assets/Scripts/GameManager.cs +++ b/namedropper/Assets/Scripts/GameManager.cs @@ -22,6 +22,7 @@ public class GameManager public static int PLAYER_SKIN = 5; //0 == puck, 1 == pancake, 2 == gummybear, 3==pig, 4==ball w/ bear, 5==pop public static int MAX_PLAYER_SKIN = 5; public static int MVP = -1; + public static bool AllowUnlock = false; bool _doubleBlueScores = false; bool _doubleRedScores = false; diff --git a/namedropper/Assets/Scripts/GameOverScreen.cs b/namedropper/Assets/Scripts/GameOverScreen.cs index 625c9c5..6d8634a 100644 --- a/namedropper/Assets/Scripts/GameOverScreen.cs +++ b/namedropper/Assets/Scripts/GameOverScreen.cs @@ -10,7 +10,7 @@ public class GameOverScreen : Level void Start() { - if (GameManager.Instance.NumTeams == 1 && false) { + if (GameManager.Instance.NumTeams == 1) { int score = GameManager.Instance.Score1 + GameManager.Instance.Score2 + GameManager.Instance.Score3 + GameManager.Instance.Score4; if (score > GameManager.Instance.HighScore) @@ -59,7 +59,8 @@ public class GameOverScreen : Level } GameManager.MVP = mvpPlayer; - _gameOverMessage.text += "\n\nPlay again?"; + if (Game.USE_UNLOCK == false) + _gameOverMessage.text += "\n\nPlay again?"; } } @@ -103,7 +104,15 @@ public class GameOverScreen : Level } private void Restart() { - GameManager.Instance.RestartGame(); + if (Game.USE_UNLOCK) + { + GameManager.AllowUnlock = true; + SceneManager.LoadScene("TopicSelect"); + } + else + { + GameManager.Instance.RestartGame(); + } } // Update is called once per frame void Update() diff --git a/namedropper/Assets/Scripts/Player.cs b/namedropper/Assets/Scripts/Player.cs index f1dfabb..2607d3f 100644 --- a/namedropper/Assets/Scripts/Player.cs +++ b/namedropper/Assets/Scripts/Player.cs @@ -349,7 +349,15 @@ public class Player : MonoBehaviour void LoadGame() { - SceneManager.LoadScene("Game"); + if (GameManager.AllowUnlock) + { + GameManager.AllowUnlock = false; + GameManager.Instance.RestartGame(); + } + else + { + SceneManager.LoadScene("Game"); + } } void LoadTopicSelect() diff --git a/namedropper/Assets/Scripts/TopicSelect.cs b/namedropper/Assets/Scripts/TopicSelect.cs index c51a04d..53ae57a 100644 --- a/namedropper/Assets/Scripts/TopicSelect.cs +++ b/namedropper/Assets/Scripts/TopicSelect.cs @@ -117,9 +117,12 @@ public class TopicSelect : Level { text += "TIE!\n"; } + + } + if (bluePicks) { text2 = "Blue team picks the " + first + "topic"; @@ -164,6 +167,14 @@ public class TopicSelect : Level text2 = "MVP picks the first topic"; } + if (GameManager.AllowUnlock) + { + titleText = "As a reward, MVP may\nunlock a new topic"; + text = ""; + text2 = ""; + //text = "It will be added to the mix until tomorrow"; + } + _title.text = titleText; _subTitle.text = text; _subTitle2.text = text2; @@ -218,12 +229,22 @@ public class TopicSelect : Level } else { - _title.text = ""; - _subTitle.text = "Pick a topic!"; - _subTitle2.text = ""; - } + if (GameManager.AllowUnlock) + { + _title.text = "As a reward, MVP may\nunlock a new topic"; + _subTitle.text = ""; + _subTitle2.text = ""; + //text = "It will be added to the mix until tomorrow"; + } + else + { + _title.text = ""; + _subTitle.text = "Pick a topic!"; + _subTitle2.text = ""; + } + } - _topic1Box.TopicData = GameDataManager.Instance.GetRandomTopicData(); + _topic1Box.TopicData = GameDataManager.Instance.GetRandomTopicData(); _topic2Box.TopicData = GameDataManager.Instance.GetRandomTopicData(); _topic3Box.TopicData = GameDataManager.Instance.GetRandomTopicData(); _topic1Box.Name = _topic1Box.TopicData.Topic; @@ -304,12 +325,11 @@ public class TopicSelect : Level _subTitle.text = ""; _subTitle2.text = ""; - /* - if (GameManager.MVP > -1) + + if (GameManager.AllowUnlock) { _subTitle2.text = "added to the mix\nuntil tomorrow!"; } - */ GameManager.MVP = -1; @@ -318,6 +338,14 @@ public class TopicSelect : Level public static void PickTopic(TopicBox topicBox) { GameDataManager.Instance.CurrentTopic = topicBox.TopicData; - SceneManager.LoadScene("Game"); + + if (GameManager.AllowUnlock) + { + GameManager.Instance.RestartGame(); + } + else + { + SceneManager.LoadScene("Game"); + } } }