Browse Source

basic spinner functionality

master
Josh 1 year ago
parent
commit
f0a0a813c8
  1. 1846
      namedropper/Assets/Scenes/LevelSelectScene.unity
  2. 8
      namedropper/Assets/Scenes/LevelSelectScene.unity.meta
  3. 154
      namedropper/Assets/Spinner.cs
  4. 11
      namedropper/Assets/Spinner.cs.meta

1846
namedropper/Assets/Scenes/LevelSelectScene.unity

File diff suppressed because it is too large

8
namedropper/Assets/Scenes/LevelSelectScene.unity.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7477ac64c25d07743a1fe5ca97591ca0
timeCreated: 1466586608
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

154
namedropper/Assets/Spinner.cs

@ -0,0 +1,154 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.Profiling;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
public class Spinner : MonoBehaviour
{
[SerializeField] TextMeshPro _topText;
[SerializeField] TextMeshPro _mainText;
[SerializeField] TextMeshPro _bottomText;
[SerializeField] TextMeshPro _instructions;
List<string> _gameList = new List<string>();
int _targetGameIndex = 0;
// Start is called before the first frame update
void Start()
{
_gameList.Add("Popstar Pursuit");
_gameList.Add("Bumper Budz 500");
_gameList.Add("Ontology: The Game");
_gameList.Add("TV Party");
_gameList.Add("Gold Digger");
_gameList.Add("Netflix & Skill");
_gameList.Add("Pixel Prodigies");
_gameList.Add("Let's Get Tipsy");
_gameList.Add("Record Scratch");
_gameList.Add("49er");
_gameList.Add("Crazy Kart");
Spin();
}
// Update is called once per frame
void Update()
{
}
public void Spin()
{
StartCoroutine(SpinCoroutine());
}
IEnumerator SpinCoroutine()
{
_instructions.gameObject.SetActive(false);
_targetGameIndex = Random.Range(0, _gameList.Count);
int currentGameIndex = _targetGameIndex + 1;
float delay = .01f;
do
{
currentGameIndex++;
if (currentGameIndex > _gameList.Count)
currentGameIndex = 0;
_topText.text = GetGameName(currentGameIndex - 1);
_mainText.text = GetGameName(currentGameIndex);
_bottomText.text = GetGameName(currentGameIndex + 1);
delay *= 1.1f;
Debug.Log("delay: " + delay);
yield return new WaitForSeconds(delay);
}
while (delay < .5f);
_mainText.color = Color.cyan;
yield return new WaitForSeconds(1.0f);
LoadScene(_mainText.text);
}
void LoadScene(string gameName)
{
string sceneName = "";
if (gameName.Contains("Dropper"))
{
sceneName = "TopicSelect";
}
else if (gameName.Contains("Popstar Pursuit"))
{
LoadNameDropper("Contemporary Pop Music");
}
else if (gameName.Contains("TV Party"))
{
LoadNameDropper("Contemporary TV");
}
else if (gameName.Contains("Netflix")) // & Skill
{
LoadNameDropper("Netflix Shows");
}
else if (gameName.Contains("Pixel")) // Pixel Prodigies
{
LoadNameDropper("Videogame Characters");
}
else if (gameName.Contains("Nik's Ark"))
{
LoadNameDropper("Animals");
}
else if (gameName.Contains("Tipsy")) //Let's Get Tipsy
{
LoadNameDropper("Alcohol");
}
else if (gameName.Contains("Record Scratch"))
{
LoadNameDropper("Music Genres");
}
else if (gameName == "Gold Digger" || gameName == "Gold Miner" || gameName.Contains("49er"))
{
sceneName = "GoldMiner";
}
else if (gameName == "Indie 500" || gameName.Contains("Bumper") || gameName.Contains("Crazy Kart"))
{
sceneName = "RaceGame";
}
else if (gameName == "Sumo")
{
sceneName = "RaceGame";
}
else if (gameName.Contains("Ontology"))
{
sceneName = "Ontology";
}
else
{
Debug.LogError("unknown game name: " + gameName);
}
if (sceneName != "")
SceneManager.LoadScene(sceneName);
}
void LoadNameDropper(string topicName)
{
GameDataManager.Instance.CurrentTopic = GameDataManager.Instance.GetTopic(topicName);
SceneManager.LoadScene("Game");
}
string GetGameName(int gameIndex)
{
if (gameIndex < 0)
gameIndex += _gameList.Count;
if (gameIndex >= _gameList.Count)
gameIndex -= _gameList.Count;
return _gameList[gameIndex];
}
}

11
namedropper/Assets/Spinner.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 905cc1ea5304df0449cf502a894c81ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save