|
|
@ -17,7 +17,11 @@ public class TopicSelect : MonoBehaviour |
|
|
|
[SerializeField] GameObject _player3; |
|
|
|
[SerializeField] GameObject _player4; |
|
|
|
|
|
|
|
const bool WORST_PLAYER_PICKS = true; |
|
|
|
public const bool WORST_PLAYER_PICKS = false; |
|
|
|
public const bool VOTE_ON_TOPIC = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Awake() |
|
|
|
{ |
|
|
@ -70,6 +74,10 @@ public class TopicSelect : MonoBehaviour |
|
|
|
|
|
|
|
_subTitle.text = worstPlayerName + "\nmay pick the topic"; |
|
|
|
} |
|
|
|
else if (VOTE_ON_TOPIC) |
|
|
|
{ |
|
|
|
_subTitle.text = "Cast your votes!"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_subTitle.text = "Pick a topic!"; |
|
|
@ -86,5 +94,56 @@ public class TopicSelect : MonoBehaviour |
|
|
|
// Update is called once per frame
|
|
|
|
void Update() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<TopicBox> _picks = new List<TopicBox>(); |
|
|
|
|
|
|
|
|
|
|
|
public void CheckForAllVotes() |
|
|
|
{ |
|
|
|
if (_topic1Box.Votes + _topic2Box.Votes + _topic3Box.Votes >= 4) |
|
|
|
{ |
|
|
|
|
|
|
|
//all votes cast
|
|
|
|
if (_topic1Box.Votes >= 2) |
|
|
|
{ |
|
|
|
_picks.Add(_topic1Box); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
GameObject.Destroy(_topic1Box.gameObject); |
|
|
|
} |
|
|
|
|
|
|
|
if (_topic2Box.Votes >= 2) |
|
|
|
{ |
|
|
|
_picks.Add(_topic2Box); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
GameObject.Destroy(_topic2Box.gameObject); |
|
|
|
} |
|
|
|
|
|
|
|
if (_topic3Box.Votes >= 2) |
|
|
|
{ |
|
|
|
_picks.Add(_topic3Box); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
GameObject.Destroy(_topic3Box.gameObject); |
|
|
|
} |
|
|
|
|
|
|
|
if (_picks.Count > 1) |
|
|
|
_subTitle.text = "Breaking tie randomly!"; |
|
|
|
|
|
|
|
Invoke("Results", 2f); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Results() |
|
|
|
{ |
|
|
|
TopicBox topicBox = _picks[Random.Range(0, _picks.Count)]; |
|
|
|
GameDataManager.Instance.CurrentTopic = topicBox.TopicData; |
|
|
|
SceneManager.LoadScene("Game"); |
|
|
|
} |
|
|
|
} |
|
|
|