diff --git a/namedropper/Assets/Scenes/Title.unity b/namedropper/Assets/Scenes/Title.unity index 380f7c6..e297f2a 100644 --- a/namedropper/Assets/Scenes/Title.unity +++ b/namedropper/Assets/Scenes/Title.unity @@ -291,7 +291,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: 4 players ready + m_text: best with 4 players m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2} m_sharedMaterial: {fileID: 1001970574707011636, guid: 4fe6d5308385b4341885d0d510c8e2aa, type: 2} diff --git a/namedropper/Assets/Calibration.cs b/namedropper/Assets/Scripts/Calibration.cs similarity index 100% rename from namedropper/Assets/Calibration.cs rename to namedropper/Assets/Scripts/Calibration.cs diff --git a/namedropper/Assets/Calibration.cs.meta b/namedropper/Assets/Scripts/Calibration.cs.meta similarity index 100% rename from namedropper/Assets/Calibration.cs.meta rename to namedropper/Assets/Scripts/Calibration.cs.meta diff --git a/namedropper/Assets/CalibrationBox.cs b/namedropper/Assets/Scripts/CalibrationBox.cs similarity index 100% rename from namedropper/Assets/CalibrationBox.cs rename to namedropper/Assets/Scripts/CalibrationBox.cs diff --git a/namedropper/Assets/CalibrationBox.cs.meta b/namedropper/Assets/Scripts/CalibrationBox.cs.meta similarity index 100% rename from namedropper/Assets/CalibrationBox.cs.meta rename to namedropper/Assets/Scripts/CalibrationBox.cs.meta diff --git a/namedropper/Assets/Scripts/Category.cs b/namedropper/Assets/Scripts/Category.cs index 4486f7f..61f558b 100644 --- a/namedropper/Assets/Scripts/Category.cs +++ b/namedropper/Assets/Scripts/Category.cs @@ -95,9 +95,12 @@ public class Category : MonoBehaviour string retVal = WorkingElements[index]; WorkingElements.RemoveAt(index); if (WorkingElements.Count == 0) + { + Debug.Log("used up all elements"); ResetElements(); + } - return retVal; + return retVal; } } diff --git a/namedropper/Assets/Scripts/Game.cs b/namedropper/Assets/Scripts/Game.cs index f12db7d..37e9cae 100644 --- a/namedropper/Assets/Scripts/Game.cs +++ b/namedropper/Assets/Scripts/Game.cs @@ -162,9 +162,25 @@ public class Game : Level void ActivatePlayers(bool value) { - foreach (GameObject player in _players) + + if (value == false) { - player.SetActive(value); + foreach (GameObject player in _players) + { + player.SetActive(false); + } + } + else //value = true + { + foreach (GameObject player in _players) + { + if (GameManager.Instance.PlayerJoined[player.GetComponent()._playerNumber] == true || + SceneManager.GetActiveScene().name == "PlayerSelectJoin") + { + player.SetActive(true); + } + } + } } IEnumerator Countdown() diff --git a/namedropper/Assets/Scripts/GameManager.cs b/namedropper/Assets/Scripts/GameManager.cs index 7e7d848..ca43aae 100644 --- a/namedropper/Assets/Scripts/GameManager.cs +++ b/namedropper/Assets/Scripts/GameManager.cs @@ -5,6 +5,7 @@ using UnityEngine.SceneManagement; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; using System.IO; +using System.Runtime.InteropServices.WindowsRuntime; public class GameManager { @@ -16,8 +17,8 @@ public class GameManager int _score4 = 0; int _highScore = 0; int _round = 1; - int _numPlayers; bool _competitive = true; + public bool[] PlayerJoined = new bool[4]; 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; @@ -46,6 +47,11 @@ public class GameManager Score3 = 0; Score4 = 0; Round = 1; + + for (int i = 0; i < 4; i++) + { + PlayerJoined[i] = false; + } } public void RestartGame() @@ -75,6 +81,18 @@ public class GameManager public int Score4 { get => _score4; set => _score4 = value; } public int Round { get => _round; set => _round = value; } public int HighScore { get => _highScore; set => _highScore = value; } - public int NumPlayers { get => _numPlayers; set => _numPlayers = value; } + public int NumPlayers { + get { + int retVal = 0; + foreach (bool b in PlayerJoined) + { + if (b == true) + { + retVal++; + } + } + return retVal; + } + } public bool Competitive { get => _competitive; set => _competitive = value; } } \ No newline at end of file diff --git a/namedropper/Assets/GameOverScreen.cs b/namedropper/Assets/Scripts/GameOverScreen.cs similarity index 100% rename from namedropper/Assets/GameOverScreen.cs rename to namedropper/Assets/Scripts/GameOverScreen.cs diff --git a/namedropper/Assets/GameOverScreen.cs.meta b/namedropper/Assets/Scripts/GameOverScreen.cs.meta similarity index 100% rename from namedropper/Assets/GameOverScreen.cs.meta rename to namedropper/Assets/Scripts/GameOverScreen.cs.meta diff --git a/namedropper/Assets/Join.cs b/namedropper/Assets/Scripts/Join.cs similarity index 94% rename from namedropper/Assets/Join.cs rename to namedropper/Assets/Scripts/Join.cs index 116d95c..985f135 100644 --- a/namedropper/Assets/Join.cs +++ b/namedropper/Assets/Scripts/Join.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; +using static UnityEditor.Experimental.GraphView.GraphView; public class Join : MonoBehaviour { @@ -26,7 +27,7 @@ public class Join : MonoBehaviour void UpdateText() { - _numPlayersReadyText.text = NumPlayersReady + " players ready"; + //_numPlayersReadyText.text = NumPlayersReady + " players ready"; } // Update is called once per frame void Update() diff --git a/namedropper/Assets/Join.cs.meta b/namedropper/Assets/Scripts/Join.cs.meta similarity index 100% rename from namedropper/Assets/Join.cs.meta rename to namedropper/Assets/Scripts/Join.cs.meta diff --git a/namedropper/Assets/JoinGameBox.cs b/namedropper/Assets/Scripts/JoinGameBox.cs similarity index 100% rename from namedropper/Assets/JoinGameBox.cs rename to namedropper/Assets/Scripts/JoinGameBox.cs diff --git a/namedropper/Assets/JoinGameBox.cs.meta b/namedropper/Assets/Scripts/JoinGameBox.cs.meta similarity index 100% rename from namedropper/Assets/JoinGameBox.cs.meta rename to namedropper/Assets/Scripts/JoinGameBox.cs.meta diff --git a/namedropper/Assets/JoinPlayer.cs b/namedropper/Assets/Scripts/JoinPlayer.cs similarity index 98% rename from namedropper/Assets/JoinPlayer.cs rename to namedropper/Assets/Scripts/JoinPlayer.cs index 3186106..2b89829 100644 --- a/namedropper/Assets/JoinPlayer.cs +++ b/namedropper/Assets/Scripts/JoinPlayer.cs @@ -39,6 +39,7 @@ public class JoinPlayer : MonoBehaviour void StartTimer() { _timer = 10; + UpdateTitle(); Invoke("Countdown", 1f); } diff --git a/namedropper/Assets/JoinPlayer.cs.meta b/namedropper/Assets/Scripts/JoinPlayer.cs.meta similarity index 100% rename from namedropper/Assets/JoinPlayer.cs.meta rename to namedropper/Assets/Scripts/JoinPlayer.cs.meta diff --git a/namedropper/Assets/NumPlayerPicker.cs b/namedropper/Assets/Scripts/NumPlayerPicker.cs similarity index 100% rename from namedropper/Assets/NumPlayerPicker.cs rename to namedropper/Assets/Scripts/NumPlayerPicker.cs diff --git a/namedropper/Assets/NumPlayerPicker.cs.meta b/namedropper/Assets/Scripts/NumPlayerPicker.cs.meta similarity index 100% rename from namedropper/Assets/NumPlayerPicker.cs.meta rename to namedropper/Assets/Scripts/NumPlayerPicker.cs.meta diff --git a/namedropper/Assets/Scripts/Player.cs b/namedropper/Assets/Scripts/Player.cs index 0125024..4bb9d39 100644 --- a/namedropper/Assets/Scripts/Player.cs +++ b/namedropper/Assets/Scripts/Player.cs @@ -67,6 +67,7 @@ public class Player : MonoBehaviour _originalPosition = transform.position; + if (GameManager.Instance.NumPlayers == 1) { if (_playerNumber != 1) @@ -285,6 +286,7 @@ public class Player : MonoBehaviour jp.Join(); this.gameObject.SetActive(false); + GameManager.Instance.PlayerJoined[_playerNumber] = true; //StartCountdown(); //if (_joinedPlayers) diff --git a/namedropper/Assets/Replay.cs b/namedropper/Assets/Scripts/Replay.cs similarity index 100% rename from namedropper/Assets/Replay.cs rename to namedropper/Assets/Scripts/Replay.cs diff --git a/namedropper/Assets/Replay.cs.meta b/namedropper/Assets/Scripts/Replay.cs.meta similarity index 100% rename from namedropper/Assets/Replay.cs.meta rename to namedropper/Assets/Scripts/Replay.cs.meta diff --git a/namedropper/Assets/RoundIntro.cs b/namedropper/Assets/Scripts/RoundIntro.cs similarity index 100% rename from namedropper/Assets/RoundIntro.cs rename to namedropper/Assets/Scripts/RoundIntro.cs diff --git a/namedropper/Assets/RoundIntro.cs.meta b/namedropper/Assets/Scripts/RoundIntro.cs.meta similarity index 100% rename from namedropper/Assets/RoundIntro.cs.meta rename to namedropper/Assets/Scripts/RoundIntro.cs.meta diff --git a/namedropper/Assets/RoundOutro.cs b/namedropper/Assets/Scripts/RoundOutro.cs similarity index 100% rename from namedropper/Assets/RoundOutro.cs rename to namedropper/Assets/Scripts/RoundOutro.cs diff --git a/namedropper/Assets/RoundOutro.cs.meta b/namedropper/Assets/Scripts/RoundOutro.cs.meta similarity index 100% rename from namedropper/Assets/RoundOutro.cs.meta rename to namedropper/Assets/Scripts/RoundOutro.cs.meta diff --git a/namedropper/Assets/ScoreStack.cs b/namedropper/Assets/Scripts/ScoreStack.cs similarity index 100% rename from namedropper/Assets/ScoreStack.cs rename to namedropper/Assets/Scripts/ScoreStack.cs diff --git a/namedropper/Assets/ScoreStack.cs.meta b/namedropper/Assets/Scripts/ScoreStack.cs.meta similarity index 100% rename from namedropper/Assets/ScoreStack.cs.meta rename to namedropper/Assets/Scripts/ScoreStack.cs.meta diff --git a/namedropper/Assets/TrackballInputManager.cs b/namedropper/Assets/Scripts/TrackballInputManager.cs similarity index 100% rename from namedropper/Assets/TrackballInputManager.cs rename to namedropper/Assets/Scripts/TrackballInputManager.cs diff --git a/namedropper/Assets/TrackballInputManager.cs.meta b/namedropper/Assets/Scripts/TrackballInputManager.cs.meta similarity index 100% rename from namedropper/Assets/TrackballInputManager.cs.meta rename to namedropper/Assets/Scripts/TrackballInputManager.cs.meta