From 8a212338e3fae7e55ae11be6dc29038765ca233c Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 22 Feb 2023 23:47:45 -0500 Subject: [PATCH] loser picks topic --- namedropper/Assets/Scenes/TopicSelect.unity | 111 +++++++++++++++++++- namedropper/Assets/Scripts/TopicSelect.cs | 58 +++++++++- 2 files changed, 164 insertions(+), 5 deletions(-) diff --git a/namedropper/Assets/Scenes/TopicSelect.unity b/namedropper/Assets/Scenes/TopicSelect.unity index 3277f87..00e1305 100644 --- a/namedropper/Assets/Scenes/TopicSelect.unity +++ b/namedropper/Assets/Scenes/TopicSelect.unity @@ -167,6 +167,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1225785572} + - {fileID: 277092717} m_Father: {fileID: 1666960088} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -333,6 +334,90 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 9049015333349338420, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} m_PrefabInstance: {fileID: 261236785} m_PrefabAsset: {fileID: 0} +--- !u!1 &261236787 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 9049015333349338381, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + m_PrefabInstance: {fileID: 261236785} + m_PrefabAsset: {fileID: 0} +--- !u!1 &277092716 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 277092717} + - component: {fileID: 277092719} + - component: {fileID: 277092718} + m_Layer: 5 + m_Name: Subtitle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &277092717 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 277092716} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 107001399} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 80.1} + m_SizeDelta: {x: 167.5, y: 231.1} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &277092718 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 277092716} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0.4462726, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: aceb68b22a47f0f4dbf70163ea752dad, type: 3} + m_FontSize: 56 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 3 + m_MaxSize: 300 + m_Alignment: 1 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Pick a Topic +--- !u!222 &277092719 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 277092716} + m_CullTransparentMesh: 1 --- !u!1 &868125098 GameObject: m_ObjectHideFlags: 0 @@ -546,6 +631,11 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 9049015333349338420, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} m_PrefabInstance: {fileID: 1003872900} m_PrefabAsset: {fileID: 0} +--- !u!1 &1003872902 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 9049015333349338381, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + m_PrefabInstance: {fileID: 1003872900} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1192266242 PrefabInstance: m_ObjectHideFlags: 0 @@ -716,6 +806,11 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 9049015333349338420, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} m_PrefabInstance: {fileID: 1192266242} m_PrefabAsset: {fileID: 0} +--- !u!1 &1192266244 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 9049015333349338381, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + m_PrefabInstance: {fileID: 1192266242} + m_PrefabAsset: {fileID: 0} --- !u!1 &1225785571 GameObject: m_ObjectHideFlags: 0 @@ -774,7 +869,7 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_FontData: - m_Font: {fileID: 12800000, guid: b46f1d3bdf627d645a08de1c3a257a10, type: 3} + m_Font: {fileID: 12800000, guid: aceb68b22a47f0f4dbf70163ea752dad, type: 3} m_FontSize: 115 m_FontStyle: 0 m_BestFit: 0 @@ -786,9 +881,7 @@ MonoBehaviour: m_HorizontalOverflow: 1 m_VerticalOverflow: 1 m_LineSpacing: 1 - m_Text: 'Round 1 - - Pick a Topic' + m_Text: Round 1 --- !u!222 &1225785574 CanvasRenderer: m_ObjectHideFlags: 0 @@ -1033,6 +1126,11 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 9049015333349338420, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} m_PrefabInstance: {fileID: 1272407093} m_PrefabAsset: {fileID: 0} +--- !u!1 &1272407095 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 9049015333349338381, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + m_PrefabInstance: {fileID: 1272407093} + m_PrefabAsset: {fileID: 0} --- !u!1 &1439945299 GameObject: m_ObjectHideFlags: 0 @@ -1166,6 +1264,11 @@ MonoBehaviour: _topic2Box: {fileID: 1500576227} _topic3Box: {fileID: 18155122} _title: {fileID: 1225785573} + _subTitle: {fileID: 277092718} + _player1: {fileID: 261236787} + _player2: {fileID: 1272407095} + _player3: {fileID: 1192266244} + _player4: {fileID: 1003872902} --- !u!4 &1641253473 Transform: m_ObjectHideFlags: 0 diff --git a/namedropper/Assets/Scripts/TopicSelect.cs b/namedropper/Assets/Scripts/TopicSelect.cs index f4701fa..1442cda 100644 --- a/namedropper/Assets/Scripts/TopicSelect.cs +++ b/namedropper/Assets/Scripts/TopicSelect.cs @@ -9,7 +9,15 @@ public class TopicSelect : MonoBehaviour [SerializeField] TopicBox _topic2Box; [SerializeField] TopicBox _topic3Box; [SerializeField] Text _title; + [SerializeField] Text _subTitle; + + [SerializeField] GameObject _player1; + [SerializeField] GameObject _player2; + [SerializeField] GameObject _player3; + [SerializeField] GameObject _player4; + + const bool WORST_PLAYER_PICKS = true; // Start is called before the first frame update void Awake() { @@ -18,7 +26,55 @@ public class TopicSelect : MonoBehaviour void InitRound() { - _title.text = "Round " + GameManager.Instance.Round + "\nPick a Topic!"; + _title.text = "Round " + GameManager.Instance.Round; + + if (WORST_PLAYER_PICKS) + { + string worstPlayerName = ""; + int worstScore = int.MaxValue; + int worstPlayerNumber = 0; + + if (GameManager.Instance.Score1 < worstScore) + { + worstScore = GameManager.Instance.Score1; + worstPlayerName = "light blue"; + worstPlayerNumber = 1; + } + if (GameManager.Instance.Score2 < worstScore) + { + worstScore = GameManager.Instance.Score2; + worstPlayerName = "dark blue"; + worstPlayerNumber = 2; + } + if (GameManager.Instance.Score3 < worstScore) + { + worstScore = GameManager.Instance.Score3; + worstPlayerName = "dark red"; + worstPlayerNumber = 3; + } + if (GameManager.Instance.Score4 < worstScore) + { + worstScore = GameManager.Instance.Score4; + worstPlayerName = "light red"; + worstPlayerNumber = 4; + } + + if (worstPlayerNumber != 1) + GameObject.Destroy(_player1); + if (worstPlayerNumber != 2) + GameObject.Destroy(_player2); + if (worstPlayerNumber != 3) + GameObject.Destroy(_player3); + if (worstPlayerNumber != 4) + GameObject.Destroy(_player4); + + _subTitle.text = worstPlayerName + "\nmay pick the topic"; + } + else + { + _subTitle.text = "Pick a topic!"; + } + _topic1Box.TopicData = GameDataManager.Instance.GetRandomTopicData(); _topic2Box.TopicData = GameDataManager.Instance.GetRandomTopicData(); _topic3Box.TopicData = GameDataManager.Instance.GetRandomTopicData();