Implemented matching dice rooms
This commit is contained in:
parent
dbef10d80a
commit
1b55b43f34
3 changed files with 59 additions and 12 deletions
|
|
@ -53,8 +53,8 @@ public class GameManager : MonoBehaviour
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case GameState.PickRoomOne when room.number != _dicePairOne.Sum():
|
||||
case GameState.PickRoomTwo when room.number != _dicePairTwo.Sum():
|
||||
case GameState.PickRoomOne when !room.TryUnlock(_dicePairOne):
|
||||
case GameState.PickRoomTwo when !room.TryUnlock(_dicePairTwo):
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public class GameManager : MonoBehaviour
|
|||
if (_dicePairOne.AreBothDiceSelected())
|
||||
{
|
||||
state = GameState.PickRoomOne;
|
||||
HighLightValidRoomsWithNumber(_dicePairOne.Sum());
|
||||
HighLightValidRoomsWithNumber(_dicePairOne);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,14 +96,14 @@ public class GameManager : MonoBehaviour
|
|||
}
|
||||
case GameState.PickDiceTwo:
|
||||
{
|
||||
if (!_dicePairTwo.IsDieInPair(die))
|
||||
if (!_dicePairTwo.IsDieInPair(die) && !_dicePairOne.IsDieInPair(die))
|
||||
{
|
||||
_dicePairTwo.SelectDie(die);
|
||||
|
||||
if (_dicePairTwo.AreBothDiceSelected())
|
||||
{
|
||||
state = GameState.PickRoomTwo;
|
||||
HighLightValidRoomsWithNumber(_dicePairTwo.Sum());
|
||||
HighLightValidRoomsWithNumber(_dicePairTwo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -112,12 +112,12 @@ public class GameManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
void HighLightValidRoomsWithNumber(int number)
|
||||
void HighLightValidRoomsWithNumber(DicePair pair)
|
||||
{
|
||||
foreach (Transform roomTransform in rooms.transform)
|
||||
{
|
||||
Room room = roomTransform.gameObject.GetComponent<Room>();
|
||||
if (room.number == number && room.IsValidRoomToExplore())
|
||||
if (room.TryUnlock(pair) && room.IsValidRoomToExplore())
|
||||
{
|
||||
room.HighlightRoomAsOption();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue