Fixed a bug with checking panel order and winner status.

This commit is contained in:
Jamie Greunbaum 2025-06-17 17:54:11 -04:00
parent 43bed62c7e
commit 5374cc5e1d

View File

@ -71,10 +71,12 @@ public class LocationBoard : UdonSharpBehaviour
else if (_HasBeenCheckedBefore[Panel - 1]) else if (_HasBeenCheckedBefore[Panel - 1])
{ {
_GameManager.AlreadyTried(); _GameManager.AlreadyTried();
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 1.0f);
} }
else else
{ {
_GameManager.NothingThere(); _GameManager.NothingThere();
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 1.0f);
} }
} break; } break;
case 1: case 1:
@ -110,17 +112,37 @@ public class LocationBoard : UdonSharpBehaviour
{ {
_GameManager.AlreadyTried(); _GameManager.AlreadyTried();
} }
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 1.0f);
} }
else else
{ {
_GameManager.NothingThere(); _GameManager.NothingThere();
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 1.0f);
} }
} break; } break;
case 2: case 2:
{ {
_OrderIsCorrect[2] = (Panel == CrookLocation); _OrderIsCorrect[2] = (Panel == CrookLocation);
if (_HasBeenCheckedBefore[Panel - 1]) if (_OrderIsCorrect[2])
{
if (!_OrderIsCorrect[1] || !_OrderIsCorrect[0])
{
_GameManager.OutOfOrder(PanelType.Crook);
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 2.5f);
}
}
else if (Panel == LootLocation)
{
_GameManager.OutOfOrder(PanelType.Loot);
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 2.5f);
}
else if (Panel == WarrantLocation)
{
_GameManager.OutOfOrder(PanelType.Warrant);
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 2.5f);
}
else if (_HasBeenCheckedBefore[Panel - 1])
{ {
if (!_OrderIsCorrect[0] || !_OrderIsCorrect[1]) if (!_OrderIsCorrect[0] || !_OrderIsCorrect[1])
{ {
@ -130,10 +152,12 @@ public class LocationBoard : UdonSharpBehaviour
{ {
_GameManager.AlreadyTried(); _GameManager.AlreadyTried();
} }
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 1.0f);
} }
else else
{ {
_GameManager.NothingThere(); _GameManager.NothingThere();
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 1.0f);
} }
} break; } break;
} }
@ -152,15 +176,11 @@ public class LocationBoard : UdonSharpBehaviour
//else if (Panel == CrookLocation) //else if (Panel == CrookLocation)
//{ //{
//} //}
if (_OrderIsCorrect[0] && _OrderIsCorrect[1] && _OrderIsCorrect[2])
{
_GameManager.YoureWinner();
}
} }
else
if (_OrderIsCorrect[0] && _OrderIsCorrect[1] && _OrderIsCorrect[2])
{ {
SendCustomEventDelayedSeconds(nameof(InitiateBoardReset), 1.0f); _GameManager.YoureWinner();
} }
} }