From 39a4a3eccd512437df128cef5457d86d8dd803b7 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 11 May 2023 18:06:45 -0400 Subject: [PATCH] version played at the office --- namedropper/Assets/RaceGame.cs | 2 +- namedropper/Assets/Scenes/RaceGame.unity | 24 +++++++++-- namedropper/Assets/Scenes/Wheel Scene.unity | 6 +-- namedropper/Assets/Scripts/Game.cs | 21 ++-------- namedropper/Assets/Scripts/GameManager.cs | 6 +++ namedropper/Assets/Scripts/JoinPlayer.cs | 28 +++++++------ namedropper/Assets/Scripts/Level.cs | 40 ++++++++++++++++--- namedropper/Assets/Scripts/Player.cs | 11 ++++- namedropper/Assets/Scripts/TopicSelect.cs | 4 +- .../Assets/Scripts/TrackballInputManager.cs | 3 +- .../_FortuneWheel/Scripts/FortuneWheel.cs | 6 +-- .../ProjectSettings/EditorBuildSettings.asset | 6 +++ 12 files changed, 106 insertions(+), 51 deletions(-) diff --git a/namedropper/Assets/RaceGame.cs b/namedropper/Assets/RaceGame.cs index 93de36c..c968ea0 100644 --- a/namedropper/Assets/RaceGame.cs +++ b/namedropper/Assets/RaceGame.cs @@ -19,6 +19,6 @@ public class RaceGame : Level // Update is called once per frame void Update() { - + base.Update(); } } diff --git a/namedropper/Assets/Scenes/RaceGame.unity b/namedropper/Assets/Scenes/RaceGame.unity index 1eb0972..101621a 100644 --- a/namedropper/Assets/Scenes/RaceGame.unity +++ b/namedropper/Assets/Scenes/RaceGame.unity @@ -371,9 +371,13 @@ PrefabInstance: propertyPath: m_LocalPosition.z value: -3.63 objectReference: {fileID: 0} + - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontSize - value: 43.55 + value: 46.9 objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontAsset @@ -2386,9 +2390,13 @@ PrefabInstance: propertyPath: m_LocalPosition.z value: -3.63 objectReference: {fileID: 0} + - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontSize - value: 43.55 + value: 46.9 objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontAsset @@ -7013,9 +7021,13 @@ PrefabInstance: propertyPath: m_LocalPosition.z value: -3.63 objectReference: {fileID: 0} + - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontSize - value: 43.55 + value: 46.9 objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontAsset @@ -7502,9 +7514,13 @@ PrefabInstance: propertyPath: m_LocalPosition.z value: -3.63 objectReference: {fileID: 0} + - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + propertyPath: m_text + value: + objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontSize - value: 43.55 + value: 46.9 objectReference: {fileID: 0} - target: {fileID: 5117799249883694698, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_fontAsset diff --git a/namedropper/Assets/Scenes/Wheel Scene.unity b/namedropper/Assets/Scenes/Wheel Scene.unity index ca356ca..9248303 100644 --- a/namedropper/Assets/Scenes/Wheel Scene.unity +++ b/namedropper/Assets/Scenes/Wheel Scene.unity @@ -3280,10 +3280,10 @@ MonoBehaviour: m_EditorClassIdentifier: prizes: - Name Dropper - - Indie 500 + - Bumper Budz - Name Dropper - - Indie 500 - - Sumo + - Bumper Budz + - Bumper Budz tingSound: {fileID: 8300000, guid: a4094b6328f12884d8f174a320bff865, type: 3} speedMultiplier: 4 duration: 6 diff --git a/namedropper/Assets/Scripts/Game.cs b/namedropper/Assets/Scripts/Game.cs index f7acb96..00232da 100644 --- a/namedropper/Assets/Scripts/Game.cs +++ b/namedropper/Assets/Scripts/Game.cs @@ -7,7 +7,7 @@ using UnityEngine.SceneManagement; public class Game : Level { public const bool USE_MVP = true; - public const bool USE_UNLOCK = true; + public const bool USE_UNLOCK = false; const bool HIDE_SCORES = true; @@ -15,7 +15,6 @@ public class Game : Level [SerializeField] Text Score2; [SerializeField] Text Score3; [SerializeField] Text Score4; - [SerializeField] Text Topic; [SerializeField] GameObject CategoriesRound1; [SerializeField] GameObject CategoriesRound2; @@ -34,7 +33,7 @@ public class Game : Level // Start is called before the first frame update void Awake() { - Physics2D.gravity = new Vector2(0f, -4f); + GameManager.TurnOnGravity(); base.Awake(); if (GameManager.Instance.Round == 1) @@ -110,23 +109,9 @@ public class Game : Level Topic.text = GameDataManager.Instance.CurrentTopic.Topic; - StartCoroutine("StartupProcess"); } - IEnumerator StartupProcess() - { - ActivatePlayers(false); - Topic.gameObject.SetActive(false); - yield return new WaitForSeconds(1f); - Topic.gameObject.SetActive(true); - yield return new WaitForSeconds(2f); - RoundNumber.text = ""; - Topic.text = "GO!"; - ActivatePlayers(true); - yield return new WaitForSeconds(1f); - Topic.gameObject.SetActive(false); - Invoke("SpawnPowerup", Random.Range(8f, 12f)); - } + void SpawnPowerup() { diff --git a/namedropper/Assets/Scripts/GameManager.cs b/namedropper/Assets/Scripts/GameManager.cs index a5d5f80..e4d1581 100644 --- a/namedropper/Assets/Scripts/GameManager.cs +++ b/namedropper/Assets/Scripts/GameManager.cs @@ -19,6 +19,7 @@ public class GameManager int _round = 1; public bool[] PlayerJoined = new bool[4]; + public static bool MINIGAMES = true; 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; @@ -27,6 +28,11 @@ public class GameManager bool _doubleBlueScores = false; bool _doubleRedScores = false; + public static void TurnOnGravity() + { + Physics2D.gravity = new Vector2(0f, -4f); + } + public string GetRoundName() { if (Round == 3) diff --git a/namedropper/Assets/Scripts/JoinPlayer.cs b/namedropper/Assets/Scripts/JoinPlayer.cs index 70eb8fb..5ca0d94 100644 --- a/namedropper/Assets/Scripts/JoinPlayer.cs +++ b/namedropper/Assets/Scripts/JoinPlayer.cs @@ -16,6 +16,7 @@ public class JoinPlayer : MonoBehaviour // Start is called before the first frame update void Start() { + GameManager.TurnOnGravity(); UpdateTitle(); } @@ -32,7 +33,7 @@ public class JoinPlayer : MonoBehaviour if (_NumPlayersJoined >= 4) { - Invoke("LoadTopicSelect", 2f); + Invoke("GotoFirstScene", 2f); } } @@ -51,7 +52,7 @@ public class JoinPlayer : MonoBehaviour if (_timer == 1) { - Invoke("LoadTopicSelect", 1f); + Invoke("LoadFirstScene", 1f); } else { @@ -59,7 +60,7 @@ public class JoinPlayer : MonoBehaviour } } - void LoadTopicSelect() + void LoadFirstScene() { if (GameManager.Instance.NumPlayers == 0) { @@ -89,17 +90,20 @@ public class JoinPlayer : MonoBehaviour } _title.text = "Uneven teams!\n\n" + color + " team earns 2x points"; - Invoke("GotoTopicSelect", 2f); + Invoke("GotoFirstScene", 2f); } else { - GotoTopicSelect(); + GotoFirstScene(); } } - void GotoTopicSelect() + void GotoFirstScene() { - SceneManager.LoadScene("TopicSelect"); + if (GameManager.MINIGAMES) + SceneManager.LoadScene("Wheel Scene"); + else + SceneManager.LoadScene("TopicSelect"); } void Redo() @@ -139,7 +143,7 @@ public class JoinPlayer : MonoBehaviour /* if (Input.GetMouseButtonDown(0)) { - LoadTopicSelect(); + LoadFirstScene(); } */ @@ -149,7 +153,7 @@ public class JoinPlayer : MonoBehaviour GameManager.Instance.PlayerJoined[0] = true; UpdateTitle(); - LoadTopicSelect(); + LoadFirstScene(); } if (Input.GetKeyDown(KeyCode.Alpha2)) @@ -158,7 +162,7 @@ public class JoinPlayer : MonoBehaviour GameManager.Instance.PlayerJoined[0] = true; GameManager.Instance.PlayerJoined[3] = true; UpdateTitle(); - LoadTopicSelect(); + LoadFirstScene(); } if (Input.GetKeyDown(KeyCode.Alpha3)) { @@ -167,7 +171,7 @@ public class JoinPlayer : MonoBehaviour GameManager.Instance.PlayerJoined[1] = true; GameManager.Instance.PlayerJoined[3] = true; UpdateTitle(); - LoadTopicSelect(); + LoadFirstScene(); } if (Input.GetKeyDown(KeyCode.Alpha4)) { @@ -177,7 +181,7 @@ public class JoinPlayer : MonoBehaviour GameManager.Instance.PlayerJoined[2] = true; GameManager.Instance.PlayerJoined[3] = true; UpdateTitle(); - LoadTopicSelect(); + LoadFirstScene(); } } } diff --git a/namedropper/Assets/Scripts/Level.cs b/namedropper/Assets/Scripts/Level.cs index ea75e3f..3ba12b9 100644 --- a/namedropper/Assets/Scripts/Level.cs +++ b/namedropper/Assets/Scripts/Level.cs @@ -9,8 +9,10 @@ public class Level : MonoBehaviour public List _players; ScoreStack _blueScoreStack; ScoreStack _redScoreStack; - [SerializeField] protected Text Timer; - [SerializeField] protected Text RoundNumber; + [SerializeField] protected Text Timer; + [SerializeField] protected Text RoundNumber; + [SerializeField] protected Text Topic; + int _originalFontSize; int _seconds = 70; static bool _paused = false; @@ -25,10 +27,13 @@ public class Level : MonoBehaviour public void Awake() { - RoundNumber.text = GameManager.Instance.GetRoundName(); + if (RoundNumber != null) + RoundNumber.text = GameManager.Instance.GetRoundName(); _blueScoreStack = GameObject.Find("/ScoreStackBlue")?.GetComponent(); _redScoreStack = GameObject.Find("/ScoreStackRed")?.GetComponent(); - _originalFontSize = Timer.fontSize; + + if (Timer != null) + _originalFontSize = Timer.fontSize; if (GameManager.Instance.Round == 1) { @@ -44,7 +49,27 @@ public class Level : MonoBehaviour } StartCoroutine(Countdown()); + StartCoroutine(StartupProcess()); + + } + IEnumerator StartupProcess() + { + ActivatePlayers(false); + if (Topic != null) + Topic.gameObject.SetActive(false); + yield return new WaitForSeconds(1f); + if (Topic != null) + Topic.gameObject.SetActive(true); + yield return new WaitForSeconds(2f); + RoundNumber.text = ""; + if (Topic != null) + Topic.text = "GO!"; + ActivatePlayers(true); + yield return new WaitForSeconds(1f); + if (Topic != null) + Topic.gameObject.SetActive(false); + //Invoke("SpawnPowerup", Random.Range(8f, 12f)); } // Update is called once per frame @@ -152,13 +177,16 @@ public class Level : MonoBehaviour { SceneManager.LoadScene("GameOver"); } - else if (GameManager.Instance.Round == 3) + else if (GameManager.Instance.Round == 3 && GameManager.MINIGAMES == false) { SceneManager.LoadScene("ChallengingStage"); } else { - SceneManager.LoadScene("TopicSelect"); + if (GameManager.MINIGAMES) + SceneManager.LoadScene("Wheel Scene"); + else + SceneManager.LoadScene("TopicSelect"); } } } diff --git a/namedropper/Assets/Scripts/Player.cs b/namedropper/Assets/Scripts/Player.cs index 2dc551c..baba2f2 100644 --- a/namedropper/Assets/Scripts/Player.cs +++ b/namedropper/Assets/Scripts/Player.cs @@ -39,6 +39,7 @@ public class Player : MonoBehaviour bool _poweredUp = false; float _powerupTimeLeft = 0f; public Player PassInputOnto = null; + int _laps = 0; public enum Team { @@ -362,7 +363,15 @@ public class Player : MonoBehaviour if (_touchedMidpoint) { Debug.Log("scored!"); - _raceGame.AddScore(1, _playerNumber); + int score = 10; + if (GameManager.Instance.Round == 3) + score *= 2; + _raceGame.AddScore(score, _playerNumber); + _laps++; + _text.text = _laps + " lap"; + if (_laps > 1) + _text.text += "s"; + } _touchedMidpoint = false; } diff --git a/namedropper/Assets/Scripts/TopicSelect.cs b/namedropper/Assets/Scripts/TopicSelect.cs index 53ae57a..984f39e 100644 --- a/namedropper/Assets/Scripts/TopicSelect.cs +++ b/namedropper/Assets/Scripts/TopicSelect.cs @@ -25,10 +25,10 @@ public class TopicSelect : Level void Awake() { - StartCoroutine("StartupProcess"); + StartCoroutine("StartupProcessTopicSelect"); } - IEnumerator StartupProcess() + IEnumerator StartupProcessTopicSelect() { ActivatePlayers(false); ActivatePlayers(true); diff --git a/namedropper/Assets/Scripts/TrackballInputManager.cs b/namedropper/Assets/Scripts/TrackballInputManager.cs index f7620d7..3761d81 100644 --- a/namedropper/Assets/Scripts/TrackballInputManager.cs +++ b/namedropper/Assets/Scripts/TrackballInputManager.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using UnityEngine.UI; using UnityEditor; +using UnityEngine.SceneManagement; public class TrackballInputManager : MonoBehaviour { @@ -164,7 +165,7 @@ public class TrackballInputManager : MonoBehaviour dy *= accelerationMultiplier; } - if (dy < 0) + if (dy < 0 && SceneManager.GetActiveScene().name == "Game") dy *= upMultiplier; //use this method to move using position diff --git a/namedropper/Assets/_FortuneWheel/Scripts/FortuneWheel.cs b/namedropper/Assets/_FortuneWheel/Scripts/FortuneWheel.cs index 217ad45..cd52dcd 100644 --- a/namedropper/Assets/_FortuneWheel/Scripts/FortuneWheel.cs +++ b/namedropper/Assets/_FortuneWheel/Scripts/FortuneWheel.cs @@ -152,15 +152,15 @@ if (_gameName == "Name Dropper") { - sceneName = "RoundIntro"; + sceneName = "TopicSelect"; } - else if (_gameName == "Indie 500") + else if (_gameName == "Indie 500" || _gameName == "Bumper Budz") { sceneName = "RaceGame"; } else if (_gameName == "Sumo") { - sceneName = "RoundIntro"; + sceneName = "RaceGame"; } else { diff --git a/namedropper/ProjectSettings/EditorBuildSettings.asset b/namedropper/ProjectSettings/EditorBuildSettings.asset index 9967d19..60a7fe6 100644 --- a/namedropper/ProjectSettings/EditorBuildSettings.asset +++ b/namedropper/ProjectSettings/EditorBuildSettings.asset @@ -29,9 +29,15 @@ EditorBuildSettings: - enabled: 0 path: guid: 00000000000000000000000000000000 + - enabled: 1 + path: Assets/Scenes/Wheel Scene.unity + guid: 6ca8f0d3b0498db4cb867d37d1589231 - enabled: 1 path: Assets/Scenes/RoundIntro.unity guid: b0725f8c0f4a77b4cb681eccd438a4c2 + - enabled: 1 + path: Assets/Scenes/RaceGame.unity + guid: 4b27426029785474c988419c9328a8ba - enabled: 1 path: Assets/Scenes/Game.unity guid: fc389e04780671f498562f1d56f81afb