From 7809458b7a56287ec5ca7edba99e6976397f8e19 Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 30 Jan 2023 19:50:35 -0500 Subject: [PATCH] after playtest with Nik --- namedropper/Assets/Scenes/Game.unity | 93 ++++++++++++++++++++++- namedropper/Assets/Scripts/Game.cs | 9 ++- namedropper/Assets/Scripts/GameManager.cs | 2 + namedropper/Assets/Scripts/Player.cs | 3 +- 4 files changed, 102 insertions(+), 5 deletions(-) diff --git a/namedropper/Assets/Scenes/Game.unity b/namedropper/Assets/Scenes/Game.unity index ca0f709..8058a50 100644 --- a/namedropper/Assets/Scenes/Game.unity +++ b/namedropper/Assets/Scenes/Game.unity @@ -282,6 +282,7 @@ RectTransform: m_Children: - {fileID: 1225785572} - {fileID: 1957998282} + - {fileID: 119717090} m_Father: {fileID: 1666960088} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -290,6 +291,85 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &119717089 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 119717090} + - component: {fileID: 119717091} + - component: {fileID: 119717092} + m_Layer: 5 + m_Name: Score2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &119717090 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 119717089} + 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: 2 + 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: 876.5, y: 423} + m_SizeDelta: {x: 167.5, y: 231.1} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &119717091 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 119717089} + m_CullTransparentMesh: 1 +--- !u!114 &119717092 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 119717089} + 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: 1, g: 0, b: 0.3764706, 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: b46f1d3bdf627d645a08de1c3a257a10, type: 3} + m_FontSize: 115 + 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: 0 + m_LineSpacing: 1 + m_Text: 5 --- !u!4 &191539951 stripped Transform: m_CorrespondingSourceObject: {fileID: 1499098757095760799, guid: f3f23d9506e39c54cbd07779c62329a3, type: 3} @@ -578,7 +658,7 @@ RectTransform: 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: -875.7, y: 423} + m_AnchoredPosition: {x: -4.3, y: 423} m_SizeDelta: {x: 167.5, y: 231.1} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1225785573 @@ -913,6 +993,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Score: {fileID: 1957998283} + Score2: {fileID: 119717092} Timer: {fileID: 1225785573} --- !u!4 &1641253473 Transform: @@ -1376,7 +1457,7 @@ RectTransform: 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: 876.5, y: 423} + m_AnchoredPosition: {x: -870.9, y: 423} m_SizeDelta: {x: 167.5, y: 231.1} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1957998283 @@ -1452,6 +1533,10 @@ PrefabInstance: propertyPath: _keyRight value: 108 objectReference: {fileID: 0} + - target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + propertyPath: _playerNumber + value: 2 + objectReference: {fileID: 0} - target: {fileID: 9049015333349338379, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_Sprite value: @@ -1773,6 +1858,10 @@ PrefabInstance: propertyPath: _keyDrop value: 122 objectReference: {fileID: 0} + - target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} + propertyPath: _playerNumber + value: 1 + objectReference: {fileID: 0} - target: {fileID: 9049015333349338378, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3} propertyPath: m_Mass value: 0.5 diff --git a/namedropper/Assets/Scripts/Game.cs b/namedropper/Assets/Scripts/Game.cs index 1f30e69..54f7ad1 100644 --- a/namedropper/Assets/Scripts/Game.cs +++ b/namedropper/Assets/Scripts/Game.cs @@ -8,6 +8,7 @@ public class Game : MonoBehaviour int _seconds = 90; [SerializeField] Text Score; + [SerializeField] Text Score2; [SerializeField] Text Timer; Category[] _categories; @@ -70,9 +71,12 @@ public class Game : MonoBehaviour UpdateScores(); } - public void AddScore(int amount = 1) + public void AddScore(int amount = 1, int player = 1) { - GameManager.Instance.Score += amount; + if (player == 1) + GameManager.Instance.Score += amount; + else + GameManager.Instance.Score2 += amount; UpdateScores(); } @@ -86,6 +90,7 @@ public class Game : MonoBehaviour public void UpdateScores() { Score.text = GameManager.Instance.Score.ToString(); + Score2.text = GameManager.Instance.Score2.ToString(); } // Update is called once per frame diff --git a/namedropper/Assets/Scripts/GameManager.cs b/namedropper/Assets/Scripts/GameManager.cs index 651fdfe..5eb7242 100644 --- a/namedropper/Assets/Scripts/GameManager.cs +++ b/namedropper/Assets/Scripts/GameManager.cs @@ -11,6 +11,7 @@ public class GameManager private static GameManager _instance = null; int _score = 0; + int _score2 = 0; int _highScore = 0; int _round = 1; @@ -45,6 +46,7 @@ public class GameManager } public int Score { get => _score; set => _score = value; } + public int Score2 { get => _score2; set => _score2 = value; } public int Round { get => _round; set => _round = value; } public int HighScore { get => _highScore; set => _highScore = value; } } \ No newline at end of file diff --git a/namedropper/Assets/Scripts/Player.cs b/namedropper/Assets/Scripts/Player.cs index 9ce32e7..2f17dc1 100644 --- a/namedropper/Assets/Scripts/Player.cs +++ b/namedropper/Assets/Scripts/Player.cs @@ -16,6 +16,7 @@ public class Player : MonoBehaviour [SerializeField] Text _text; [SerializeField] bool _forTopicSelect = false; Game _game; + [SerializeField] int _playerNumber; bool _dropping = false; Vector3 _originalPosition; public enum Team @@ -66,7 +67,7 @@ public class Player : MonoBehaviour if (category.Elements.Contains(_text.text)) { - _game.AddScore(); + _game.AddScore(1, _playerNumber); category.ShowFeedbackGood(); } else