Browse Source

version from Gumbo playtest

combinedRaceAndNameDropper
Josh 2 years ago
parent
commit
5ada7306c0
  1. 3
      namedropper/Assets/Join.cs
  2. 79
      namedropper/Assets/JoinPlayer.cs
  3. 11
      namedropper/Assets/JoinPlayer.cs.meta
  4. 19
      namedropper/Assets/NumPlayerPicker.cs
  5. 11
      namedropper/Assets/NumPlayerPicker.cs.meta
  6. 18
      namedropper/Assets/PlayerJoin.cs
  7. 11
      namedropper/Assets/PlayerJoin.cs.meta
  8. 2282
      namedropper/Assets/Scenes/NumPlayersSelect.unity
  9. 7
      namedropper/Assets/Scenes/NumPlayersSelect.unity.meta
  10. 1836
      namedropper/Assets/Scenes/PlayerSelectJoin.unity
  11. 7
      namedropper/Assets/Scenes/PlayerSelectJoin.unity.meta
  12. 4
      namedropper/Assets/Scripts/Game.cs
  13. 86
      namedropper/Assets/Scripts/Player.cs
  14. 17
      namedropper/Assets/Scripts/Powerup.cs
  15. 2
      namedropper/Assets/Scripts/TopicSelect.cs
  16. 2
      namedropper/Assets/TrackballInputManager.cs
  17. 12
      namedropper/ProjectSettings/EditorBuildSettings.asset

3
namedropper/Assets/Join.cs

@ -88,6 +88,7 @@ public class Join : MonoBehaviour
void StartGame() void StartGame()
{ {
GameManager.Instance.NumPlayers = NumPlayersReady; GameManager.Instance.NumPlayers = NumPlayersReady;
SceneManager.LoadScene("TopicSelect"); //SceneManager.LoadScene("NumPlayersSelect");
SceneManager.LoadScene("PlayerSelectJoin");
} }
} }

79
namedropper/Assets/JoinPlayer.cs

@ -0,0 +1,79 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class JoinPlayer : MonoBehaviour
{
[SerializeField] Text _title;
[SerializeField] TMPro.TMP_Text _subtitle;
public int _NumPlayersJoined = 0;
int _timer = 100;
// Start is called before the first frame update
void Start()
{
UpdateTitle();
}
public void Join()
{
_NumPlayersJoined++;
UpdateTitle();
if (_NumPlayersJoined == 1)
{
StartTimer();
}
if (_NumPlayersJoined >= 4)
{
Invoke("LoadTopicSelect", 2f);
}
}
void StartTimer()
{
_timer = 10;
Invoke("Countdown", 1f);
}
void Countdown()
{
_timer--;
UpdateTitle();
if (_timer == 0)
{
Invoke("LoadTopicSelect", 1f);
}
else
{
Invoke("Countdown", 1f);
}
}
void LoadTopicSelect()
{
SceneManager.LoadScene("TopicSelect");
}
void UpdateTitle()
{
_title.text = "Roll to the box\n\n" + _NumPlayersJoined + " players joined";
if (_timer < 99)
{
_title.text += "\n" + _timer;
}
}
// Update is called once per frame
void Update()
{
}
}

11
namedropper/Assets/JoinPlayer.cs.meta

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

19
namedropper/Assets/NumPlayerPicker.cs

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NumPlayerPicker : MonoBehaviour
{
public int NumPlayers;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
namedropper/Assets/NumPlayerPicker.cs.meta

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

18
namedropper/Assets/PlayerJoin.cs

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerJoin : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
namedropper/Assets/PlayerJoin.cs.meta

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

2282
namedropper/Assets/Scenes/NumPlayersSelect.unity

File diff suppressed because it is too large

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

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

1836
namedropper/Assets/Scenes/PlayerSelectJoin.unity

File diff suppressed because it is too large

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

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

4
namedropper/Assets/Scripts/Game.cs

@ -142,7 +142,7 @@ public class Game : Level
{ {
GameObject powerup = Instantiate(_powerupPrefab); GameObject powerup = Instantiate(_powerupPrefab);
powerup.transform.parent = _canvas.gameObject.transform; powerup.transform.parent = _canvas.gameObject.transform;
powerup.transform.position = new Vector3(0, Random.Range(225f, 820f), powerup.transform.position.z); powerup.transform.position = new Vector3(Random.Range(100f, 1080f-100f), Random.Range(225f, 820f), powerup.transform.position.z);
if (GameManager.Instance.Round == 3) if (GameManager.Instance.Round == 3)
Invoke("SpawnPowerup", Random.Range(7f, 16f)); Invoke("SpawnPowerup", Random.Range(7f, 16f));
@ -182,7 +182,7 @@ public class Game : Level
Timer.text = "TIME'S UP!"; Timer.text = "TIME'S UP!";
Timer.fontSize = _originalFontSize + 70; Timer.fontSize = _originalFontSize + 70;
Paused = true; Paused = true;
yield return new WaitForSeconds(5f); yield return new WaitForSeconds(2.5f);
Paused = false; Paused = false;
NextRound(); NextRound();

86
namedropper/Assets/Scripts/Player.cs

@ -8,7 +8,7 @@ using UnityEngine.UIElements;
public class Player : MonoBehaviour public class Player : MonoBehaviour
{ {
const bool ALLOW_DROP = false; const bool ALLOW_DROP = false;
const float SPEED = 3000f; const float SPEED = 2000f;
[SerializeField] KeyCode _keyLeft; [SerializeField] KeyCode _keyLeft;
[SerializeField] KeyCode _keyRight; [SerializeField] KeyCode _keyRight;
[SerializeField] KeyCode _keyDown; [SerializeField] KeyCode _keyDown;
@ -230,9 +230,68 @@ public class Player : MonoBehaviour
else else
{ {
GameDataManager.Instance.CurrentTopic = topicBox.TopicData; GameDataManager.Instance.CurrentTopic = topicBox.TopicData;
SceneManager.LoadScene("Game"); DisableAllPlayers();
//destroy the other topics
TopicBox[] topicBoxes = GameObject.FindObjectsOfType<TopicBox>();
foreach (TopicBox tb in topicBoxes)
{
if (tb != topicBox)
{
GameObject.Destroy(tb.gameObject);
}
}
Invoke("LoadGame", 2f);
}
}
//num players
NumPlayerPicker numPlayerPicker = collision.gameObject.GetComponent<NumPlayerPicker>();
if (numPlayerPicker != null)
{
//destroy the other player picker
NumPlayerPicker[] playerPickers = GameObject.FindObjectsOfType<NumPlayerPicker>();
foreach (NumPlayerPicker pp in playerPickers)
{
if (pp != numPlayerPicker)
{
GameObject.Destroy(pp.gameObject);
}
}
DisableAllPlayers();
Invoke("LoadTopicSelect", 2f);
//LoadGame();
//Invoke("LoadGame", 1f);
}
//join
PlayerJoin playerJoin = collision.gameObject.GetComponent<PlayerJoin>();
if (playerJoin != null)
{
/*
//destroy the other player picker
NumPlayerPicker[] playerPickers = GameObject.FindObjectsOfType<NumPlayerPicker>();
foreach (NumPlayerPicker pp in playerPickers)
{
if (pp != numPlayerPicker)
{
GameObject.Destroy(pp.gameObject);
} }
} }
*/
JoinPlayer jp = GameObject.FindObjectOfType<JoinPlayer>();
jp.Join();
this.gameObject.SetActive(false);
//StartCountdown();
//if (_joinedPlayers)
//Invoke("LoadTopicSelect", 2f);
//LoadGame();
//Invoke("LoadGame", 1f);
}
//calibration box //calibration box
CalibrationBox calibrationBox = collision.gameObject.GetComponent<CalibrationBox>(); CalibrationBox calibrationBox = collision.gameObject.GetComponent<CalibrationBox>();
@ -253,6 +312,29 @@ public class Player : MonoBehaviour
_poweredUp = true; _poweredUp = true;
_powerupTimeLeft = 10f; _powerupTimeLeft = 10f;
} }
}
void DisableAllPlayers()
{
Player[] players = GameObject.FindObjectsOfType<Player>();
foreach (Player p in players)
{
p.gameObject.SetActive(false);
}
}
void LoadGame()
{
SceneManager.LoadScene("Game");
}
void LoadTopicSelect()
{
SceneManager.LoadScene("TopicSelect");
} }
// Update is called once per frame // Update is called once per frame

17
namedropper/Assets/Scripts/Powerup.cs

@ -7,6 +7,7 @@ public class Powerup : MonoBehaviour
const float SPEED = 200f; const float SPEED = 200f;
List<Player> _players = new List<Player>(); List<Player> _players = new List<Player>();
float _direction = 1f; float _direction = 1f;
float _timeToFlip = 0f;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -19,6 +20,17 @@ public class Powerup : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
_timeToFlip -= Time.deltaTime;
if (_timeToFlip < 0f)
{
transform.localScale = new Vector3(transform.localScale.x * -1f, transform.localScale.y, transform.localScale.z);
_timeToFlip = .1f;
}
/*
Player closestPlayer = null; Player closestPlayer = null;
float closestDistance = 9999999f; float closestDistance = 9999999f;
foreach (Player player in _players) foreach (Player player in _players)
@ -39,10 +51,9 @@ public class Powerup : MonoBehaviour
direction.Normalize(); direction.Normalize();
direction.z = 0f; direction.z = 0f;
}
transform.position += direction * Time.deltaTime * -1 * SPEED; transform.position += direction * Time.deltaTime * -1 * SPEED;
}
*/
} }
} }

2
namedropper/Assets/Scripts/TopicSelect.cs

@ -17,7 +17,7 @@ public class TopicSelect : Level
[SerializeField] GameObject _player3; [SerializeField] GameObject _player3;
[SerializeField] GameObject _player4; [SerializeField] GameObject _player4;
public const bool WORST_PLAYER_PICKS = false; public const bool WORST_PLAYER_PICKS = true;
public const bool VOTE_ON_TOPIC = false; public const bool VOTE_ON_TOPIC = false;

2
namedropper/Assets/TrackballInputManager.cs

@ -8,7 +8,7 @@ using UnityEditor;
public class TrackballInputManager : MonoBehaviour public class TrackballInputManager : MonoBehaviour
{ {
const float defaultMiceSensitivity = 2.5f; const float defaultMiceSensitivity = 1.5f;
const float upMultiplier = .5f; const float upMultiplier = .5f;
const float accelerationThreshold = 120; const float accelerationThreshold = 120;
const float accelerationMultiplier = .5f; const float accelerationMultiplier = .5f;

12
namedropper/ProjectSettings/EditorBuildSettings.asset

@ -11,18 +11,24 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scenes/Calibration.unity path: Assets/Scenes/Calibration.unity
guid: 1cdfc7379ea90c34e8ce5d94b5b43e30 guid: 1cdfc7379ea90c34e8ce5d94b5b43e30
- enabled: 1
path: Assets/Scenes/NumPlayersSelect.unity
guid: f0146dae2f8468b459055fb0bc4de467
- enabled: 1 - enabled: 1
path: Assets/Scenes/TopicSelect.unity path: Assets/Scenes/TopicSelect.unity
guid: a657dedad7b62af40a8121078bc5d04e guid: a657dedad7b62af40a8121078bc5d04e
- enabled: 1
path: Assets/Scenes/RoundOutro.unity
guid: 3982c6ec82b64f343a20d6a1e9b6f32f
- enabled: 1
path: Assets/Scenes/PlayerSelectJoin.unity
guid: dec16e3b1be4d704a89f82efa59198e4
- enabled: 0 - enabled: 0
path: path:
guid: 00000000000000000000000000000000 guid: 00000000000000000000000000000000
- enabled: 1 - enabled: 1
path: Assets/Scenes/RoundIntro.unity path: Assets/Scenes/RoundIntro.unity
guid: b0725f8c0f4a77b4cb681eccd438a4c2 guid: b0725f8c0f4a77b4cb681eccd438a4c2
- enabled: 1
path: Assets/Scenes/RoundOutro.unity
guid: 3982c6ec82b64f343a20d6a1e9b6f32f
- enabled: 1 - enabled: 1
path: Assets/Scenes/Game.unity path: Assets/Scenes/Game.unity
guid: fc389e04780671f498562f1d56f81afb guid: fc389e04780671f498562f1d56f81afb

Loading…
Cancel
Save