Josh
2 years ago
17 changed files with 4395 additions and 14 deletions
@ -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() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 46a85f2ce9030bc4ab4e9e5c27fadea6 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
@ -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() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: e881fc79da666c84f9ec04fa270b31a6 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
@ -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() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 7bae7ba566cf7134cba683a203eb4fc3 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
File diff suppressed because it is too large
@ -0,0 +1,7 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: f0146dae2f8468b459055fb0bc4de467 |
||||
|
DefaultImporter: |
||||
|
externalObjects: {} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
File diff suppressed because it is too large
@ -0,0 +1,7 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: dec16e3b1be4d704a89f82efa59198e4 |
||||
|
DefaultImporter: |
||||
|
externalObjects: {} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
Loading…
Reference in new issue