- Adjusted timing of confetti cannons and music end during round 2.
- Location Board now properly initialises, including randomised colours. - Location Board no longer relies on any NetworkCallable functions. - Redrew Patty Larceny and Eartha Brute portraits. - Changed all audio files to not preload. - Updated occlusion culling data.
This commit is contained in:
@@ -91,7 +91,6 @@ public class GameManagerRound2 : GameManagerBase
|
||||
private void InitialiseLocationBoard()
|
||||
{
|
||||
_LocationBoard.RandomiseLocations();
|
||||
_LocationBoard.RandomiseMaterials();
|
||||
LocationBoardReset();
|
||||
}
|
||||
|
||||
@@ -144,7 +143,8 @@ public class GameManagerRound2 : GameManagerBase
|
||||
Location = LandmarkDictionary["Location"].String;
|
||||
|
||||
_Landmarks = NewLandmarks;
|
||||
_LocationBoard.SendCustomNetworkEvent(NetworkEventTarget.All, "PopulateLandmarks", NewLandmarks);
|
||||
_LocationBoard.PopulateLandmarks(NewLandmarks);
|
||||
_LocationBoard.RandomiseMaterials();
|
||||
LocationBoardReset();
|
||||
|
||||
RequestSerialization();
|
||||
@@ -302,16 +302,18 @@ public class GameManagerRound2 : GameManagerBase
|
||||
(HostCardRecoverTheLootInterface)GetHostCardInterface(RoundSegmentType.RecoverTheLoot);
|
||||
Interface.SetComment("Winner! Congratulations, " + Winner[0], COLOR_RED);
|
||||
|
||||
_PlayerConfettiCannons[WinningPlayerNumber].Play();
|
||||
|
||||
Interface.EnableAllPanelButtons(false);
|
||||
|
||||
NetworkCalling.SendCustomNetworkEvent((IUdonEventReceiver)_AudioManager, NetworkEventTarget.All,
|
||||
"StopMusic");
|
||||
|
||||
_CameraControllerRound2.ActivateLocationBoardAndWinningPlayerCameraSwitcher();
|
||||
_CameraControllerRound2.ActivateHostWinnerCameraTrigger();
|
||||
|
||||
SendCustomEventDelayedSeconds(nameof(YoureWinnerDelayedFunctions), 1.0f);
|
||||
}
|
||||
public void YoureWinnerDelayedFunctions()
|
||||
{
|
||||
_PlayerConfettiCannons[_CurrentPlayerCounter % _Players.Length].Play();
|
||||
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "StopMusic");
|
||||
|
||||
AdvanceRound();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,8 @@
|
||||
using TMPro;
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDK3.Image;
|
||||
using VRC.SDK3.UdonNetworkCalling;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon.Common.Interfaces;
|
||||
using VRC.Udon.Common;
|
||||
|
||||
|
||||
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
||||
@@ -13,54 +11,93 @@ public class LocationBoard : UdonSharpBehaviour
|
||||
{
|
||||
[SerializeField] private GameManagerRound2 _GameManager;
|
||||
[SerializeField] private AudioManager _AudioManager;
|
||||
|
||||
[SerializeField] private Animator _Animator;
|
||||
[Space]
|
||||
[SerializeField] private MeshRenderer[] _LocationPanelInfoSheets;
|
||||
[SerializeField] private GameObject[] _LocationPanelsEmpty;
|
||||
[SerializeField] private GameObject[] _LocationPanelsLoot;
|
||||
[SerializeField] private GameObject[] _LocationPanelsWarrant;
|
||||
[SerializeField] private GameObject[] _LocationPanelsCrook;
|
||||
[SerializeField] private TextMeshProUGUI[] _LocationPanelText;
|
||||
[Space]
|
||||
[SerializeField] private Material _LootMaterial;
|
||||
[SerializeField] private Material[] _LocationSheetMaterialSelections;
|
||||
|
||||
[UdonSynced] private int[] _RandomMaterialSettings = new int[NUMBER_OF_LOCATIONS];
|
||||
private int[] _RandomMaterialSettings_Cache = new int[NUMBER_OF_LOCATIONS];
|
||||
|
||||
[UdonSynced] private string[] _Landmarks = new string[NUMBER_OF_LOCATIONS];
|
||||
private string[] _Landmarks_Cache = new string[NUMBER_OF_LOCATIONS];
|
||||
|
||||
[UdonSynced, FieldChangeCallback(nameof(LootLocation))] private int _LootLocation = 0;
|
||||
[UdonSynced, FieldChangeCallback(nameof(WarrantLocation))] private int _WarrantLocation = 0;
|
||||
[UdonSynced, FieldChangeCallback(nameof(CrookLocation))] private int _CrookLocation = 0;
|
||||
|
||||
[UdonSynced, FieldChangeCallback(nameof(Landmarks))] private string[] _Landmarks;
|
||||
[UdonSynced, FieldChangeCallback(nameof(RandomMaterialSettings))] private int[] _RandomMaterialSettings;
|
||||
|
||||
[UdonSynced, FieldChangeCallback(nameof(RevealedPanel))] private int _RevealedPanel = 0;
|
||||
|
||||
[UdonSynced] private bool[] _OrderIsCorrect = new bool[3];
|
||||
[UdonSynced] private bool[] _HasBeenCheckedBefore;
|
||||
|
||||
[SerializeField] private Material _LootMaterial;
|
||||
[SerializeField] private Material[] _LocationSheetMaterialSelections;
|
||||
|
||||
private Animator _Animator;
|
||||
[UdonSynced] private bool[] _HasBeenCheckedBefore = new bool[NUMBER_OF_LOCATIONS];
|
||||
|
||||
private int _ActiveSpinners = 0;
|
||||
|
||||
private const int NUMBER_OF_LOCATIONS = 15;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
_Animator = GetComponent<Animator>();
|
||||
_HasBeenCheckedBefore = new bool[_LocationPanelsEmpty.Length];
|
||||
|
||||
MeshRenderer LootMesh;
|
||||
if (LootMesh = _LocationPanelsLoot[0].GetComponent<MeshRenderer>())
|
||||
foreach (GameObject LootPanel in _LocationPanelsLoot)
|
||||
{
|
||||
LootMesh.sharedMaterial = _LootMaterial;
|
||||
MeshRenderer LootMesh;
|
||||
if (LootMesh = LootPanel.GetComponent<MeshRenderer>())
|
||||
{
|
||||
LootMesh.material = _LootMaterial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[NetworkCallable]
|
||||
public override void OnDeserialization(DeserializationResult Result)
|
||||
{
|
||||
if (_IsRandomMaterialListDifferent())
|
||||
{
|
||||
_ApplyRandomMaterials();
|
||||
}
|
||||
|
||||
if (_IsLandmarksListDifferent())
|
||||
{
|
||||
_ApplyPopulatedLandmarks();
|
||||
}
|
||||
|
||||
base.OnDeserialization(Result);
|
||||
}
|
||||
|
||||
|
||||
public void PopulateLandmarks(string[] NewLandmarks)
|
||||
{
|
||||
for (int i = 0; i < NewLandmarks.Length; i++)
|
||||
if (NewLandmarks.Length == NUMBER_OF_LOCATIONS)
|
||||
{
|
||||
_LocationPanelText[i].text = NewLandmarks[i];
|
||||
_Landmarks = NewLandmarks;
|
||||
if (_IsLandmarksListDifferent())
|
||||
{
|
||||
_ApplyPopulatedLandmarks();
|
||||
}
|
||||
RequestSerialization();
|
||||
}
|
||||
_Landmarks = NewLandmarks;
|
||||
else
|
||||
{
|
||||
Debug.LogError("[LocationBoard] Incorrect number of landmarks; resetting values.");
|
||||
_Landmarks = _Landmarks_Cache;
|
||||
}
|
||||
|
||||
}
|
||||
private void _ApplyPopulatedLandmarks()
|
||||
{
|
||||
for (int i = 0; i < NUMBER_OF_LOCATIONS; i++)
|
||||
{
|
||||
_LocationPanelText[i].text = _Landmarks[i];
|
||||
}
|
||||
_Landmarks_Cache = _Landmarks;
|
||||
}
|
||||
|
||||
public void SetLootImage(Texture2D LootTexture)
|
||||
@@ -77,12 +114,8 @@ public class LocationBoard : UdonSharpBehaviour
|
||||
|
||||
private void _RevealPanel_Private()
|
||||
{
|
||||
Debug.Log("[LocationBoard] Revealing panel " + RevealedPanel);
|
||||
|
||||
if (_ActiveSpinners < 3)
|
||||
{
|
||||
Debug.Log("[LocationBoard] Active spinners is currently less than three");
|
||||
|
||||
_Animator.SetBool("Flip " + RevealedPanel, true);
|
||||
|
||||
switch (_ActiveSpinners)
|
||||
@@ -243,23 +276,23 @@ public class LocationBoard : UdonSharpBehaviour
|
||||
{
|
||||
Random.InitState(Networking.GetServerTimeInMilliseconds());
|
||||
|
||||
LootLocation = Random.Range(0, _LocationPanelsLoot.Length) + 1;
|
||||
LootLocation = Random.Range(0, NUMBER_OF_LOCATIONS) + 1;
|
||||
|
||||
int TempWarrantLocation = _LootLocation;
|
||||
while (TempWarrantLocation == _LootLocation)
|
||||
{
|
||||
TempWarrantLocation = Random.Range(0, _LocationPanelsWarrant.Length) + 1;
|
||||
TempWarrantLocation = Random.Range(0, NUMBER_OF_LOCATIONS) + 1;
|
||||
}
|
||||
WarrantLocation = TempWarrantLocation;
|
||||
|
||||
int TempCrookLocation = _WarrantLocation;
|
||||
while (TempCrookLocation == _WarrantLocation || TempCrookLocation == _LootLocation)
|
||||
{
|
||||
TempCrookLocation = Random.Range(0, _LocationPanelsCrook.Length) + 1;
|
||||
TempCrookLocation = Random.Range(0, NUMBER_OF_LOCATIONS) + 1;
|
||||
}
|
||||
CrookLocation = TempCrookLocation;
|
||||
|
||||
for (int i = 0; i < _LocationPanelsEmpty.Length; i++)
|
||||
for (int i = 0; i < NUMBER_OF_LOCATIONS; i++)
|
||||
{
|
||||
_HasBeenCheckedBefore[i] = false;
|
||||
}
|
||||
@@ -269,9 +302,9 @@ public class LocationBoard : UdonSharpBehaviour
|
||||
|
||||
public void RandomiseMaterials()
|
||||
{
|
||||
int[] MaterialsArray = new int[_LocationPanelInfoSheets.Length];
|
||||
int[] MaterialsArray = new int[NUMBER_OF_LOCATIONS];
|
||||
int PreviousMaterial = 0;
|
||||
for (int i = 0; i < MaterialsArray.Length; i++)
|
||||
for (int i = 0; i < NUMBER_OF_LOCATIONS; i++)
|
||||
{
|
||||
int RandomValue = PreviousMaterial;
|
||||
while (RandomValue == PreviousMaterial)
|
||||
@@ -283,21 +316,22 @@ public class LocationBoard : UdonSharpBehaviour
|
||||
MaterialsArray[i] = RandomValue;
|
||||
}
|
||||
|
||||
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(ApplyRandomMaterials), MaterialsArray);
|
||||
_RandomMaterialSettings = MaterialsArray;
|
||||
if (_IsRandomMaterialListDifferent())
|
||||
{
|
||||
_ApplyRandomMaterials();
|
||||
}
|
||||
RequestSerialization();
|
||||
}
|
||||
|
||||
[NetworkCallable]
|
||||
public void ApplyRandomMaterials(int[] NewMaterials)
|
||||
private void _ApplyRandomMaterials()
|
||||
{
|
||||
for (int i = 0; i < NewMaterials.Length; i++)
|
||||
for (int i = 0; i < NUMBER_OF_LOCATIONS; i++)
|
||||
{
|
||||
Material[] Materials = _LocationPanelInfoSheets[i].materials;
|
||||
Materials[1] = _LocationSheetMaterialSelections[NewMaterials[i]];
|
||||
Materials[1] = _LocationSheetMaterialSelections[_RandomMaterialSettings[i]];
|
||||
_LocationPanelInfoSheets[i].materials = Materials;
|
||||
}
|
||||
|
||||
_RandomMaterialSettings = NewMaterials;
|
||||
_RandomMaterialSettings_Cache = _RandomMaterialSettings;
|
||||
}
|
||||
|
||||
private void PlaceEmpty(int Panel)
|
||||
@@ -348,13 +382,50 @@ public class LocationBoard : UdonSharpBehaviour
|
||||
}
|
||||
|
||||
MeshRenderer CrookMesh;
|
||||
if (CrookMesh = _LocationPanelsCrook[CrookLocation - 1].GetComponent<MeshRenderer>())
|
||||
if (CrookMesh = _LocationPanelsCrook[Panel - 1].GetComponent<MeshRenderer>())
|
||||
{
|
||||
CrookMesh.material.SetTexture("_MainTex", _GameManager.GetCrookPortrait());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool _IsRandomMaterialListDifferent()
|
||||
{
|
||||
if (_RandomMaterialSettings.Length != NUMBER_OF_LOCATIONS)
|
||||
{
|
||||
Debug.LogError("[LocationBoard] Random material list length is incorrect");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _RandomMaterialSettings.Length; i++)
|
||||
{
|
||||
if (_RandomMaterialSettings[i] != _RandomMaterialSettings_Cache[i])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool _IsLandmarksListDifferent()
|
||||
{
|
||||
if (_Landmarks.Length != NUMBER_OF_LOCATIONS)
|
||||
{
|
||||
Debug.LogError("[LocationBoard] Landmark list length is incorrect");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _Landmarks.Length; i++)
|
||||
{
|
||||
if (_Landmarks[i] != _Landmarks_Cache[i])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public int LootLocation
|
||||
{
|
||||
set
|
||||
@@ -388,26 +459,6 @@ public class LocationBoard : UdonSharpBehaviour
|
||||
get => _CrookLocation;
|
||||
}
|
||||
|
||||
public string[] Landmarks
|
||||
{
|
||||
set
|
||||
{
|
||||
_Landmarks = value;
|
||||
PopulateLandmarks(value);
|
||||
}
|
||||
get => _Landmarks;
|
||||
}
|
||||
|
||||
public int[] RandomMaterialSettings
|
||||
{
|
||||
set
|
||||
{
|
||||
_RandomMaterialSettings = value;
|
||||
ApplyRandomMaterials(value);
|
||||
}
|
||||
get => _RandomMaterialSettings;
|
||||
}
|
||||
|
||||
|
||||
private int RevealedPanel
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user