Browse Source

challenging state

combinedRaceAndNameDropper
Josh 2 years ago
parent
commit
37b25284fa
  1. 28
      namedropper/Assets/Gummy.cs
  2. 11
      namedropper/Assets/Gummy.cs.meta
  3. 141
      namedropper/Assets/Prefabs/Gummy Prefab.prefab
  4. 7
      namedropper/Assets/Prefabs/Gummy Prefab.prefab.meta
  5. 5201
      namedropper/Assets/Scenes/ChallengingStage.unity
  6. 7
      namedropper/Assets/Scenes/ChallengingStage.unity.meta
  7. 87
      namedropper/Assets/Scripts/ChallengingStage.cs
  8. 11
      namedropper/Assets/Scripts/ChallengingStage.cs.meta
  9. 48
      namedropper/Assets/Scripts/Game.cs
  10. 2
      namedropper/Assets/Scripts/GameOverScreen.cs
  11. 44
      namedropper/Assets/Scripts/Level.cs
  12. 8
      namedropper/Assets/Scripts/Player.cs
  13. 2
      namedropper/Assets/Scripts/Wraparound.cs
  14. 3
      namedropper/ProjectSettings/EditorBuildSettings.asset

28
namedropper/Assets/Gummy.cs

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Gummy : MonoBehaviour
{
float _timeToFlip = 0f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
_timeToFlip -= Time.deltaTime;
if (_timeToFlip < 0f)
{
transform.localScale = new Vector3(transform.localScale.x * -1f, transform.localScale.y, transform.localScale.z);
_timeToFlip = .1f;
}
}
}

11
namedropper/Assets/Gummy.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd19b62300c7bfa4896ed0b8fd20c288
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

141
namedropper/Assets/Prefabs/Gummy Prefab.prefab

@ -0,0 +1,141 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2355887706657292512
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2355887706657292524}
- component: {fileID: 2355887706657292515}
- component: {fileID: 2355887706657292514}
- component: {fileID: 2355887706657292513}
- component: {fileID: 2355887706657292525}
- component: {fileID: 180079069927992777}
m_Layer: 0
m_Name: Gummy Prefab
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2355887706657292524
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2355887706657292512}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 833.31, y: 809.7, z: -9.3}
m_LocalScale: {x: 0.38822, y: 0.38822, z: 0.38822}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2355887706657292515
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2355887706657292512}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d6c3531494da6b64fba26dea94bc6098, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 160, y: 218}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!58 &2355887706657292514
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2355887706657292512}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 109
--- !u!114 &2355887706657292513
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2355887706657292512}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02d335f1af9cc3e47837750dc736c2ba, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &2355887706657292525
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2355887706657292512}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 37dfc580ad57d894caaababe502afb5b, type: 3}
m_Name:
m_EditorClassIdentifier:
_useWorldSpace: 0
--- !u!114 &180079069927992777
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2355887706657292512}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dd19b62300c7bfa4896ed0b8fd20c288, type: 3}
m_Name:
m_EditorClassIdentifier:

7
namedropper/Assets/Prefabs/Gummy Prefab.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2d5ddcf9e0fe6dc4c9d3a05fc8c6b30b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

5201
namedropper/Assets/Scenes/ChallengingStage.unity

File diff suppressed because it is too large

7
namedropper/Assets/Scenes/ChallengingStage.unity.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 874d922a3df5d554382cd48cecf69a47
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

87
namedropper/Assets/Scripts/ChallengingStage.cs

@ -0,0 +1,87 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class ChallengingStage : Level
{
[SerializeField] Text Timer;
[SerializeField] Text Title;
[SerializeField] Text Subtitle;
[SerializeField] Canvas _canvas;
[SerializeField] GameObject _gummyPrefab;
int _seconds = 10;
int _originalFontSize;
// Start is called before the first frame update
void Start()
{
}
private void Awake()
{
base.Awake();
_originalFontSize = Timer.fontSize;
SpawnGummy();
StartCoroutine("StartupProcess");
}
IEnumerator StartupProcess()
{
ActivatePlayers(false);
Title.gameObject.SetActive(true);
Subtitle.gameObject.SetActive(false);
yield return new WaitForSeconds(1f);
Subtitle.gameObject.SetActive(true);
yield return new WaitForSeconds(2f);
Subtitle.gameObject.SetActive(false);
Title.gameObject.SetActive(true);
Title.text = "GO!";
ActivatePlayers(true);
yield return new WaitForSeconds(1f);
Title.gameObject.SetActive(false);
Subtitle.gameObject.SetActive(false);
StartCoroutine(Countdown());
}
// Update is called once per frame
void Update()
{
}
IEnumerator Countdown()
{
while (_seconds > 0)
{
_seconds--;
Timer.text = _seconds.ToString();
if (_seconds < 10)
{
Timer.color = Color.red;
Timer.fontSize = _originalFontSize + 50;
}
yield return new WaitForSeconds(1f);
}
Timer.text = "TIME'S UP!";
Timer.fontSize = _originalFontSize + 70;
Game.Paused = true;
yield return new WaitForSeconds(2.5f);
Game.Paused = false;
SceneManager.LoadScene("TopicSelect");
}
void SpawnGummy()
{
GameObject powerup = Instantiate(_gummyPrefab);
powerup.transform.parent = _canvas.gameObject.transform;
powerup.transform.position = new Vector3(Random.Range(100f, 1920f-100f), Random.Range(100f, 1080f - 100f), powerup.transform.position.z);
Invoke("SpawnGummy", Random.Range(0, 2f - (_seconds * .1f)));
}
}

11
namedropper/Assets/Scripts/ChallengingStage.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41ab2f3d89b1fa74d93e3d740bcb781b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

48
namedropper/Assets/Scripts/Game.cs

@ -25,8 +25,7 @@ public class Game : Level
ScoreStack _blueScoreStack;
ScoreStack _redScoreStack;
Category[] _categories; Category[] _categories;
int _originalFontSize; int _originalFontSize;
@ -40,8 +39,8 @@ public class Game : Level
// Start is called before the first frame update // Start is called before the first frame update
void Awake() void Awake()
{ {
_blueScoreStack = GameObject.Find("/ScoreStackBlue").GetComponent<ScoreStack>(); base.Awake();
_redScoreStack = GameObject.Find("/ScoreStackRed").GetComponent<ScoreStack>();
if (GameManager.Instance.Round == 1) if (GameManager.Instance.Round == 1)
{ {
CategoriesRound1.SetActive(true); CategoriesRound1.SetActive(true);
@ -194,6 +193,10 @@ public class Game : Level
{ {
SceneManager.LoadScene("GameOver"); SceneManager.LoadScene("GameOver");
} }
else if (GameManager.Instance.Round == 3)
{
SceneManager.LoadScene("ChallengingStage");
}
else else
{ {
SceneManager.LoadScene("TopicSelect"); SceneManager.LoadScene("TopicSelect");
@ -205,42 +208,7 @@ public class Game : Level
UpdateScores(); UpdateScores();
} }
public void AddScore(int amount = 1, int player = 1)
{
if (player == 0)
{
if (GameManager.Instance.DoubleBlueScores)
amount *= 2;
GameManager.Instance.Score1 += amount;
_blueScoreStack.AddChecker(amount/10, true);
}
else if (player == 1)
{
if (GameManager.Instance.DoubleBlueScores)
amount *= 2;
_blueScoreStack.AddChecker(amount / 10, false);
GameManager.Instance.Score2 += amount;
}
else if (player == 2)
{
if (GameManager.Instance.DoubleRedScores)
amount *= 2;
_redScoreStack.AddChecker(amount / 10, false);
GameManager.Instance.Score3 += amount;
}
else if (player == 3)
{
if (GameManager.Instance.DoubleRedScores)
amount *= 2;
_redScoreStack.AddChecker(amount / 10, true );
GameManager.Instance.Score4 += amount;
}
UpdateScores();
}
public System.Tuple<string,string> PickRandomWord() public System.Tuple<string,string> PickRandomWord()
{ {
@ -265,7 +233,7 @@ public class Game : Level
int score = GameManager.Instance.Score1 + GameManager.Instance.Score2 + GameManager.Instance.Score3 + GameManager.Instance.Score4; int score = GameManager.Instance.Score1 + GameManager.Instance.Score2 + GameManager.Instance.Score3 + GameManager.Instance.Score4;
Score1.text = score.ToString(); Score1.text = score.ToString();
} }
else { //compometitive else { //competitive
if (GameManager.Instance.NumPlayers == 1) if (GameManager.Instance.NumPlayers == 1)
{ {
Score1.text = GameManager.Instance.Score1.ToString(); Score1.text = GameManager.Instance.Score1.ToString();

2
namedropper/Assets/Scripts/GameOverScreen.cs

@ -65,7 +65,7 @@ public class GameOverScreen : Level
} }
} }
Invoke("Restart", 6); Invoke("Restart", 5);
} }

44
namedropper/Assets/Scripts/Level.cs

@ -6,6 +6,8 @@ using UnityEngine.SceneManagement;
public class Level : MonoBehaviour public class Level : MonoBehaviour
{ {
public List<GameObject> _players; public List<GameObject> _players;
ScoreStack _blueScoreStack;
ScoreStack _redScoreStack;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -13,6 +15,12 @@ public class Level : MonoBehaviour
} }
public void Awake()
{
_blueScoreStack = GameObject.Find("/ScoreStackBlue").GetComponent<ScoreStack>();
_redScoreStack = GameObject.Find("/ScoreStackRed").GetComponent<ScoreStack>();
}
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
@ -43,4 +51,40 @@ public class Level : MonoBehaviour
} }
} }
public void AddScore(int amount = 1, int player = 1)
{
if (player == 0)
{
if (GameManager.Instance.DoubleBlueScores)
amount *= 2;
GameManager.Instance.Score1 += amount;
_blueScoreStack.AddChecker(amount / 10, true);
}
else if (player == 1)
{
if (GameManager.Instance.DoubleBlueScores)
amount *= 2;
_blueScoreStack.AddChecker(amount / 10, false);
GameManager.Instance.Score2 += amount;
}
else if (player == 2)
{
if (GameManager.Instance.DoubleRedScores)
amount *= 2;
_redScoreStack.AddChecker(amount / 10, false);
GameManager.Instance.Score3 += amount;
}
else if (player == 3)
{
if (GameManager.Instance.DoubleRedScores)
amount *= 2;
_redScoreStack.AddChecker(amount / 10, true);
GameManager.Instance.Score4 += amount;
}
//UpdateScores();
}
} }

8
namedropper/Assets/Scripts/Player.cs

@ -333,6 +333,14 @@ public class Player : MonoBehaviour
_powerupTimeLeft = 10f; _powerupTimeLeft = 10f;
} }
// gummy
Gummy gummy = collision.gameObject.GetComponent<Gummy>();
if (gummy != null)
{
GameObject.Destroy(gummy.gameObject);
GameObject.FindObjectOfType<ChallengingStage>().AddScore(1, _playerNumber);
}
} }

2
namedropper/Assets/Scripts/Wraparound.cs

@ -26,7 +26,7 @@ public class Wraparound : MonoBehaviour
} }
if (SceneManager.GetActiveScene().name == "TopicSelect" || SceneManager.GetActiveScene().name == "Calibration" || SceneManager.GetActiveScene().name == "Title" || SceneManager.GetActiveScene().name == "GameOver") if (SceneManager.GetActiveScene().name == "TopicSelect" || SceneManager.GetActiveScene().name == "Calibration" || SceneManager.GetActiveScene().name == "Title" || SceneManager.GetActiveScene().name == "GameOver" || SceneManager.GetActiveScene().name == "ChallengingStage")
{ {
if (this.transform.position.x < 0) if (this.transform.position.x < 0)
{ {

3
namedropper/ProjectSettings/EditorBuildSettings.asset

@ -20,6 +20,9 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scenes/RoundOutro.unity path: Assets/Scenes/RoundOutro.unity
guid: 3982c6ec82b64f343a20d6a1e9b6f32f guid: 3982c6ec82b64f343a20d6a1e9b6f32f
- enabled: 1
path: Assets/Scenes/ChallengingStage.unity
guid: 874d922a3df5d554382cd48cecf69a47
- enabled: 1 - enabled: 1
path: Assets/Scenes/Title.unity path: Assets/Scenes/Title.unity
guid: dec16e3b1be4d704a89f82efa59198e4 guid: dec16e3b1be4d704a89f82efa59198e4

Loading…
Cancel
Save