Browse Source

start of playtest

A
Josh 2 years ago
parent
commit
9df0219fe0
  1. 14
      namedropper/Assets/GameOverScreen.cs
  2. 190
      namedropper/Assets/Scenes/Game.unity
  3. 4
      namedropper/Assets/Scenes/TopicSelect.unity
  4. 81
      namedropper/Assets/Scripts/Game.cs
  5. 13
      namedropper/Assets/Scripts/GameManager.cs
  6. 22
      namedropper/Assets/Scripts/Player.cs

14
namedropper/Assets/GameOverScreen.cs

@ -9,11 +9,19 @@ public class GameOverScreen : MonoBehaviour
void Start()
{
if (GameManager.Instance.Score > GameManager.Instance.HighScore)
if (GameManager.Instance.Competitive == false) {
int score = GameManager.Instance.Score1 + GameManager.Instance.Score2 + GameManager.Instance.Score3 + GameManager.Instance.Score4;
if (score > GameManager.Instance.HighScore)
{
GameManager.Instance.HighScore = score;
}
_gameOverMessage.text = "GAME OVER\n\nYour score: " + score + "\nToday's hi-score: " + GameManager.Instance.HighScore.ToString() + "\n\nPress 'R' to Replay";
}
else
{
GameManager.Instance.HighScore = GameManager.Instance.Score;
_gameOverMessage.text = "GAME OVER\n\nScores: " + GameManager.Instance.Score1 + "\n" + GameManager.Instance.Score2 + "\n" + GameManager.Instance.Score3 + "\n" + GameManager.Instance.Score4;
}
_gameOverMessage.text = "GAME OVER\n\nYour score: " + GameManager.Instance.Score + "\nToday's hi-score: " + GameManager.Instance.HighScore.ToString() + "\n\nPress 'R' to Replay";
}

190
namedropper/Assets/Scenes/Game.unity

@ -123,6 +123,85 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &64627487
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 64627488}
- component: {fileID: 64627490}
- component: {fileID: 64627489}
m_Layer: 5
m_Name: Score4
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &64627488
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 64627487}
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: 4
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: 286.57}
m_SizeDelta: {x: 167.5, y: 231.1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &64627489
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 64627487}
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.5411765, 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!222 &64627490
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 64627487}
m_CullTransparentMesh: 1
--- !u!1001 &76032778
PrefabInstance:
m_ObjectHideFlags: 0
@ -150,6 +229,10 @@ PrefabInstance:
propertyPath: _keyRight
value: 104
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:
@ -160,7 +243,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338381, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338420, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_Pivot.x
@ -282,7 +365,9 @@ RectTransform:
m_Children:
- {fileID: 1225785572}
- {fileID: 1957998282}
- {fileID: 1042264264}
- {fileID: 119717090}
- {fileID: 64627488}
m_Father: {fileID: 1666960088}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -303,7 +388,7 @@ GameObject:
- component: {fileID: 119717091}
- component: {fileID: 119717092}
m_Layer: 5
m_Name: Score2
m_Name: Score3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -321,7 +406,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 107001399}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -349,7 +434,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0.3764706, a: 1}
m_Color: {r: 0.5754717, g: 0, b: 0.21664816, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -513,6 +598,10 @@ PrefabInstance:
propertyPath: _keyRight
value: 275
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _playerNumber
value: 4
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338378, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_Mass
value: 0.5
@ -531,7 +620,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338381, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338420, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_Pivot.x
@ -624,6 +713,85 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 9049015333349338420, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
m_PrefabInstance: {fileID: 881809258}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1042264263
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1042264264}
- component: {fileID: 1042264266}
- component: {fileID: 1042264265}
m_Layer: 5
m_Name: Score2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1042264264
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1042264263}
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: -871.4, y: 286.57}
m_SizeDelta: {x: 167.5, y: 231.1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1042264265
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1042264263}
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.1387968, 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: 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!222 &1042264266
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1042264263}
m_CullTransparentMesh: 1
--- !u!1 &1225785571
GameObject:
m_ObjectHideFlags: 0
@ -992,8 +1160,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c2999330b51cf4c409e52d0a60d0be86, type: 3}
m_Name:
m_EditorClassIdentifier:
Score: {fileID: 1957998283}
Score2: {fileID: 119717092}
Score1: {fileID: 1957998283}
Score2: {fileID: 1042264265}
Score3: {fileID: 119717092}
Score4: {fileID: 64627489}
Timer: {fileID: 1225785573}
--- !u!4 &1641253473
Transform:
@ -1435,7 +1605,7 @@ GameObject:
- component: {fileID: 1957998284}
- component: {fileID: 1957998283}
m_Layer: 5
m_Name: Score
m_Name: Score1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1473,7 +1643,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.44705883, b: 1, a: 1}
m_Color: {r: 0, g: 0.9138589, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -1535,7 +1705,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _playerNumber
value: 2
value: 3
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338379, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_Sprite

4
namedropper/Assets/Scenes/TopicSelect.unity

@ -1113,6 +1113,10 @@ PrefabInstance:
propertyPath: _team
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _playerNumber
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _forTopicSelect
value: 1

81
namedropper/Assets/Scripts/Game.cs

@ -7,8 +7,10 @@ public class Game : MonoBehaviour
{
int _seconds = 90;
[SerializeField] Text Score;
[SerializeField] Text Score1;
[SerializeField] Text Score2;
[SerializeField] Text Score3;
[SerializeField] Text Score4;
[SerializeField] Text Timer;
Category[] _categories;
@ -34,6 +36,46 @@ public class Game : MonoBehaviour
category.ResetElements();
}
StartCoroutine(Countdown());
if (GameManager.Instance.Competitive == false)
{
Score1.gameObject.SetActive(true);
Score2.gameObject.SetActive(false);
Score3.gameObject.SetActive(false);
Score4.gameObject.SetActive(false);
}
else
{ //compometitive
if (GameManager.Instance.NumPlayers == 1)
{
Score1.gameObject.SetActive(true);
Score2.gameObject.SetActive(false);
Score3.gameObject.SetActive(false);
Score4.gameObject.SetActive(false);
}
else if (GameManager.Instance.NumPlayers == 2)
{
Score1.gameObject.SetActive(true);
Score2.gameObject.SetActive(false);
Score3.gameObject.SetActive(true);
Score4.gameObject.SetActive(false);
}
else if (GameManager.Instance.NumPlayers == 3)
{
Score1.gameObject.SetActive(true);
Score2.gameObject.SetActive(false);
Score3.gameObject.SetActive(true);
Score4.gameObject.SetActive(true);
}
else if (GameManager.Instance.NumPlayers == 4)
{
Score1.gameObject.SetActive(true);
Score2.gameObject.SetActive(false);
Score3.gameObject.SetActive(true);
Score4.gameObject.SetActive(false);
}
}
}
IEnumerator Countdown()
@ -74,9 +116,13 @@ public class Game : MonoBehaviour
public void AddScore(int amount = 1, int player = 1)
{
if (player == 1)
GameManager.Instance.Score += amount;
else
GameManager.Instance.Score1 += amount;
else if (player == 2)
GameManager.Instance.Score2 += amount;
else if (player == 3)
GameManager.Instance.Score3 += amount;
else if (player == 4)
GameManager.Instance.Score4 += amount;
UpdateScores();
}
@ -89,8 +135,33 @@ public class Game : MonoBehaviour
public void UpdateScores()
{
Score.text = GameManager.Instance.Score.ToString();
Score2.text = GameManager.Instance.Score2.ToString();
if (GameManager.Instance.Competitive == false) {
int score = GameManager.Instance.Score1 + GameManager.Instance.Score2 + GameManager.Instance.Score3 + GameManager.Instance.Score4;
Score1.text = score.ToString();
}
else { //compometitive
if (GameManager.Instance.NumPlayers == 1)
{
Score1.text = GameManager.Instance.Score1.ToString();
}
else if (GameManager.Instance.NumPlayers == 2)
{
Score1.text = GameManager.Instance.Score1.ToString();
Score3.text = GameManager.Instance.Score3.ToString();
}
else if (GameManager.Instance.NumPlayers == 3)
{
Score1.text = GameManager.Instance.Score1.ToString();
Score3.text = GameManager.Instance.Score3.ToString();
Score4.text = GameManager.Instance.Score4.ToString();
}
else if (GameManager.Instance.NumPlayers == 4)
{
Score1.text = (GameManager.Instance.Score1 + GameManager.Instance.Score2).ToString();
Score3.text = (GameManager.Instance.Score3 + GameManager.Instance.Score4).ToString();
}
}
}
// Update is called once per frame

13
namedropper/Assets/Scripts/GameManager.cs

@ -10,8 +10,10 @@ public class GameManager
{
private static GameManager _instance = null;
int _score = 0;
int _score1 = 0;
int _score2 = 0;
int _score3 = 0;
int _score4 = 0;
int _highScore = 0;
int _round = 1;
int _numPlayers;
@ -25,7 +27,10 @@ public class GameManager
void Reset()
{
Score = 0;
Score1 = 0;
Score2 = 0;
Score3 = 0;
Score4 = 0;
Round = 1;
}
@ -48,8 +53,10 @@ public class GameManager
}
}
public int Score { get => _score; set => _score = value; }
public int Score1 { get => _score1; set => _score1 = value; }
public int Score2 { get => _score2; set => _score2 = value; }
public int Score3 { get => _score3; set => _score3 = value; }
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; }

22
namedropper/Assets/Scripts/Player.cs

@ -34,6 +34,28 @@ public class Player : MonoBehaviour
_game = FindObjectOfType<Game>();
_originalPosition = transform.position;
if (GameManager.Instance.NumPlayers == 1)
{
if (_playerNumber != 1)
{
gameObject.SetActive(false);
}
}
else if (GameManager.Instance.NumPlayers == 2)
{
if (_playerNumber != 1 && _playerNumber != 3)
{
gameObject.SetActive(false);
}
}
else if (GameManager.Instance.NumPlayers == 3)
{
if (_playerNumber == 2)
{
gameObject.SetActive(false);
}
}
}
void Start()

Loading…
Cancel
Save