128 lines
2.7 KiB
C#
128 lines
2.7 KiB
C#
|
|
using System.Collections.Generic;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDK3.Data;
|
|
using VRC.SDK3.StringLoading;
|
|
using VRC.SDK3.UdonNetworkCalling;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon.Common.Interfaces;
|
|
using VRC.Udon.Serialization.OdinSerializer.Utilities;
|
|
|
|
|
|
public enum GameType
|
|
{
|
|
None,
|
|
LocateTheCrook,
|
|
RecoverTheLoot,
|
|
ChaseCarmen
|
|
}
|
|
|
|
public enum QuestionType
|
|
{
|
|
BetweenRounds,
|
|
MultipleChoice,
|
|
LightningRound,
|
|
DumpsterDive,
|
|
TheChase,
|
|
FinalRound,
|
|
Tiebreaker
|
|
}
|
|
|
|
public enum MusicEventType
|
|
{
|
|
None,
|
|
TheChase,
|
|
ThinkAboutIt,
|
|
WhereInTheWorld,
|
|
RockapellaIdent
|
|
}
|
|
|
|
public enum SFXEventType
|
|
{
|
|
None,
|
|
Ding,
|
|
Buzzer
|
|
}
|
|
|
|
|
|
public class GameManagerBase : UdonSharpBehaviour
|
|
{
|
|
[UdonSynced] protected bool _GameHasBegun = false;
|
|
|
|
[SerializeField] protected HostCardManager _HostCard = null;
|
|
|
|
private bool _AllowInteractionFromHostCard = false;
|
|
|
|
|
|
void Start()
|
|
{
|
|
InitialiseGameMode();
|
|
}
|
|
|
|
protected void EnableInteraction(string NextInteraction = "Advance")
|
|
{
|
|
_AllowInteractionFromHostCard = true;
|
|
_HostCard.SetNextInteractionText(NextInteraction);
|
|
}
|
|
protected void DisableInteraction()
|
|
{
|
|
_AllowInteractionFromHostCard = false;
|
|
}
|
|
|
|
public bool IsInteractionEnabled()
|
|
{
|
|
return _AllowInteractionFromHostCard;
|
|
}
|
|
|
|
public void HostCardUseButtonDown()
|
|
{
|
|
if (!IsInteractionEnabled()) { return; }
|
|
|
|
_HostCardUseButtonDown_Internal();
|
|
}
|
|
|
|
protected virtual HostCardInterfaceBase GetHostCardInterface(QuestionType Question)
|
|
{
|
|
Debug.LogError("You should not be seeing this. You don't need to run base.GetHostCardInterface()");
|
|
return _HostCard.EnableHostCardDisplay(GameType.None, Question);
|
|
}
|
|
|
|
protected virtual void _HostCardUseButtonDown_Internal()
|
|
{
|
|
Debug.LogError("You should not be seeing this. You don't need to call base._HostCardUseButtonDown_Internal()");
|
|
}
|
|
|
|
|
|
protected virtual void InitialiseGameMode() { }
|
|
|
|
public virtual void LoadQuestionData(DataToken Data) { }
|
|
|
|
|
|
protected string GameTypeToString(GameType Type)
|
|
{
|
|
switch ((int)Type)
|
|
{
|
|
case (int)GameType.LocateTheCrook: return "Locate The Crook";
|
|
case (int)GameType.RecoverTheLoot: return "Recover The Loot";
|
|
case (int)GameType.ChaseCarmen: return "Chase Carmen";
|
|
default: return "[[ERROR]]";
|
|
}
|
|
}
|
|
|
|
protected string QuestionTypeToString(QuestionType Type)
|
|
{
|
|
switch ((int)Type)
|
|
{
|
|
case (int)QuestionType.BetweenRounds: return "None";
|
|
case (int)QuestionType.MultipleChoice: return "Standard Round";
|
|
case (int)QuestionType.LightningRound: return "Lightning Round";
|
|
case (int)QuestionType.DumpsterDive: return "Dumpster Dive";
|
|
case (int)QuestionType.TheChase: return "The Chase";
|
|
case (int)QuestionType.FinalRound: return "Final Round";
|
|
case (int)QuestionType.Tiebreaker: return "Tiebreaker";
|
|
default: return "[[ERROR]]";
|
|
}
|
|
}
|
|
}
|