- Added some dings and the ACME Crimenet logo.

- Dings now play when revealing answer choices.
This commit is contained in:
Jamie Greunbaum
2025-06-01 20:34:22 -04:00
parent 6aa533d6a6
commit dbbdc7625d
10 changed files with 305 additions and 67 deletions
+84 -30
View File
@@ -44,19 +44,19 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 20
Data: 21
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: BuzzInAllowed
Data: _BuzzInAllowed
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: BuzzInAllowed
Data: _BuzzInAllowed
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
@@ -110,13 +110,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: PlayerBuzzInAllowed
Data: _PlayerBuzzInAllowed
- Name: $v
Entry: 7
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: PlayerBuzzInAllowed
Data: _PlayerBuzzInAllowed
- Name: <UserType>k__BackingField
Entry: 7
Data: 7|System.RuntimeType, mscorlib
@@ -911,13 +911,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: BuzzerSound
Data: _Ding
- Name: $v
Entry: 7
Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: BuzzerSound
Data: _Ding
- Name: <UserType>k__BackingField
Entry: 7
Data: 56|System.RuntimeType, mscorlib
@@ -980,13 +980,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: WhereInTheWorld
Data: _Buzzer
- Name: $v
Entry: 7
Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: WhereInTheWorld
Data: _Buzzer
- Name: <UserType>k__BackingField
Entry: 9
Data: 56
@@ -1034,13 +1034,13 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: RockapellaIdent
Data: _WhereInTheWorld
- Name: $v
Entry: 7
Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: RockapellaIdent
Data: _WhereInTheWorld
- Name: <UserType>k__BackingField
Entry: 9
Data: 56
@@ -1088,25 +1088,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: MusicPlayer
Data: _RockapellaIdent
- Name: $v
Entry: 7
Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: MusicPlayer
Data: _RockapellaIdent
- Name: <UserType>k__BackingField
Entry: 7
Data: 67|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.AudioSource, UnityEngine.AudioModule
- Name:
Entry: 8
Data:
Entry: 9
Data: 56
- Name: <SystemType>k__BackingField
Entry: 9
Data: 67
Data: 56
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1121,13 +1115,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 68|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 69|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 68|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -1148,19 +1142,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: SFXPlayer
Data: _MusicPlayer
- Name: $v
Entry: 7
Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: SFXPlayer
Data: _MusicPlayer
- Name: <UserType>k__BackingField
Entry: 9
Data: 67
Entry: 7
Data: 70|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.AudioSource, UnityEngine.AudioModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 67
Data: 70
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1197,6 +1197,60 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _SFXPlayer
- Name: $v
Entry: 7
Data: 73|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _SFXPlayer
- Name: <UserType>k__BackingField
Entry: 9
Data: 70
- Name: <SystemType>k__BackingField
Entry: 9
Data: 70
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 74|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 75|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
+47 -27
View File
@@ -32,6 +32,7 @@ public enum MusicEventType
public enum SFXEventType
{
None,
Ding,
Buzzer
}
@@ -39,8 +40,8 @@ public enum SFXEventType
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class GameManager : UdonSharpBehaviour
{
[UdonSynced] private bool BuzzInAllowed = false;
[UdonSynced] private bool[] PlayerBuzzInAllowed;
[UdonSynced] private bool _BuzzInAllowed = false;
[UdonSynced] private bool[] _PlayerBuzzInAllowed;
[UdonSynced] private int _BuzzedInPlayer = 0;
private DataList _QuestionsList = new DataList();
@@ -61,17 +62,18 @@ public class GameManager : UdonSharpBehaviour
[SerializeField] private TextMeshProUGUI _Answer;
[Header("Audio")]
[SerializeField] private AudioClip BuzzerSound = null;
[SerializeField] private AudioClip _Ding = null;
[SerializeField] private AudioClip _Buzzer = null;
[SerializeField] private AudioClip WhereInTheWorld = null;
[SerializeField] private AudioClip RockapellaIdent = null;
[SerializeField] private AudioClip _WhereInTheWorld = null;
[SerializeField] private AudioClip _RockapellaIdent = null;
[SerializeField] private AudioSource MusicPlayer = null;
[SerializeField] private AudioSource SFXPlayer = null;
[SerializeField] private AudioSource _MusicPlayer = null;
[SerializeField] private AudioSource _SFXPlayer = null;
void Start()
{
PlayerBuzzInAllowed = new bool[PlayerPodiums.Length];
_PlayerBuzzInAllowed = new bool[PlayerPodiums.Length];
ResetBuzzers();
// Download our test question.
@@ -104,7 +106,7 @@ public class GameManager : UdonSharpBehaviour
_CurrentQuestion = _QuestionsList[0].DataDictionary;
Debug.Log("Found " + _QuestionsList.Count + " questions in this case file.");
_InfoHeader.text = "Found " + _QuestionsList.Count + " questions in this case file.";
}
else
{
@@ -143,10 +145,14 @@ public class GameManager : UdonSharpBehaviour
public void MultipleChoiceRevealChoice1()
{
_InfoChoiceButtons[0].color = (_QuestionCorrectResponse == 1) ? Color.green : Color.red;
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(PlaySFXAtPitch), SFXEventType.Ding, 1.0f);
}
public void MultipleChoiceRevealChoice2()
{
_InfoChoiceButtons[1].color = (_QuestionCorrectResponse == 2) ? Color.green : Color.red;
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(PlaySFXAtPitch), SFXEventType.Ding, 1.1224566408889556272993467978076f);
}
public void MultipleChoiceRevealChoice3()
{
@@ -177,6 +183,8 @@ public class GameManager : UdonSharpBehaviour
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)PlayerPodiums[i], NetworkEventTarget.All, "SetCardChoices", ChoiceStrings, ChoiceOrder);
}
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(PlaySFXAtPitch), SFXEventType.Ding, 1.2599186983149743116707603530939f);
EnableInteraction("Lock Answers");
}
@@ -275,7 +283,7 @@ public class GameManager : UdonSharpBehaviour
public void EnableBuzzInPeriodForAllPlayers()
{
BuzzInAllowed = true;
_BuzzInAllowed = true;
ResetBuzzers();
}
@@ -283,11 +291,11 @@ public class GameManager : UdonSharpBehaviour
public void PlayerBuzzedIn(int PlayerNumber)
{
int PlayerIndex = PlayerNumber - 1;
if (!BuzzInAllowed || !PlayerBuzzInAllowed[PlayerIndex]) { return; }
if (!_BuzzInAllowed || !_PlayerBuzzInAllowed[PlayerIndex]) { return; }
// Prevent new buzz-ins and store which player is currently buzzed in.
BuzzInAllowed = false;
PlayerBuzzInAllowed[PlayerIndex] = false;
_BuzzInAllowed = false;
_PlayerBuzzInAllowed[PlayerIndex] = false;
_BuzzedInPlayer = PlayerNumber;
RequestSerialization();
@@ -301,7 +309,7 @@ public class GameManager : UdonSharpBehaviour
}
public void WaitForBuzzInsWithoutLastPlayer() {
BuzzInAllowed = true;
_BuzzInAllowed = true;
NetworkCalling.SendCustomNetworkEvent(
(IUdonEventReceiver)PlayerPodiums[_BuzzedInPlayer - 1],
NetworkEventTarget.All,
@@ -312,13 +320,13 @@ public class GameManager : UdonSharpBehaviour
public void EndBuzzInPeriod()
{
BuzzInAllowed = false;
_BuzzInAllowed = false;
ResetBuzzers();
}
public void ResetBuzzers()
{
for (int i = 0; i < PlayerPodiums.Length; i++) { PlayerBuzzInAllowed[i] = true; }
for (int i = 0; i < PlayerPodiums.Length; i++) { _PlayerBuzzInAllowed[i] = true; }
_BuzzedInPlayer = -1;
}
@@ -362,33 +370,45 @@ public class GameManager : UdonSharpBehaviour
[NetworkCallable]
public void PlayMusic(MusicEventType MusicEvent)
{
MusicPlayer.Stop();
_MusicPlayer.Stop();
switch (MusicEvent)
{
case MusicEventType.WhereInTheWorld: MusicPlayer.clip = WhereInTheWorld; break;
case MusicEventType.RockapellaIdent: MusicPlayer.clip = RockapellaIdent; break;
default: MusicPlayer.clip = null; break;
case MusicEventType.WhereInTheWorld: _MusicPlayer.clip = _WhereInTheWorld; break;
case MusicEventType.RockapellaIdent: _MusicPlayer.clip = _RockapellaIdent; break;
default: _MusicPlayer.clip = null; break;
}
if (MusicPlayer.clip != null)
MusicPlayer.Play();
if (_MusicPlayer.clip != null)
_MusicPlayer.Play();
}
[NetworkCallable]
public void PlaySFX(SFXEventType SFXEvent)
{
SFXPlayer.Stop();
PlaySFXInternal(SFXEvent);
}
[NetworkCallable]
public void PlaySFXAtPitch(SFXEventType SFXEvent, float Pitch)
{
PlaySFXInternal(SFXEvent, Pitch);
}
private void PlaySFXInternal(SFXEventType SFXEvent, float Pitch = 1.0f)
{
_SFXPlayer.Stop();
switch (SFXEvent)
{
case SFXEventType.Buzzer: SFXPlayer.clip = BuzzerSound; break;
default: SFXPlayer.clip = null; break;
case SFXEventType.Ding: _SFXPlayer.clip = _Ding; break;
case SFXEventType.Buzzer: _SFXPlayer.clip = _Buzzer; break;
default: _SFXPlayer.clip = null; break;
}
if (SFXPlayer.clip != null)
SFXPlayer.Play();
if (_SFXPlayer.clip != null)
_SFXPlayer.pitch = Pitch;
_SFXPlayer.Play();
}