void TurnEnd(int pawnID, int progress) { var pawn = Pawns.Get(pawnID); coroutines.StopAll(); if (PhotonNetwork.IsMasterClient) { if (pawn.CurrentElement == Grid.Last) { Core.Match.End(pawn); } else { PawnIndex = ClampToPlayerIndex(PawnIndex + 1); } } else { pawn.SyncProgress(progress); } pawn.Land(); if (OnTurnEnd != null) { OnTurnEnd(pawn, progress); } if (PhotonNetwork.IsMasterClient) { photonView.RPC(nameof(TurnInitiation), RpcTarget.All, Pawns[PawnIndex].ID); } }
void RollRPC(int pawnID, int roll) { var pawn = Pawns.Get(pawnID); if (Pawns.IsLocal(pawn)) { Core.Dice.Interactable = false; } else { Core.Dice.Value = roll; } if (PhotonNetwork.IsMasterClient) { if (pawn != Pawns[PawnIndex]) { Debug.LogWarning("Pawn: " + pawn.name + " Threw dice when it wasn't their turn, ignoring"); return; } if (InTurn) { Debug.LogWarning("Pawn: " + pawn.name + " Threw dice mid-turn, ignoring"); return; } photonView.RPC(nameof(TurnStart), RpcTarget.All, pawn.ID, pawn.Progress, roll); } }
void TurnInitiation(int pawnID) { var pawn = Pawns.Get(pawnID); Core.Dice.Interactable = Pawns.IsLocal(pawn); if (OnTurnInitiation != null) { OnTurnInitiation(pawn); } }
void TurnStart(int pawnID, int progress, int roll) { var pawn = Pawns.Get(pawnID); var target = Grid.Get(Grid[progress], roll); coroutines.Start(Procedure(pawn, Grid[progress], target)); if (OnTurnStart != null) { OnTurnStart(pawn, progress, roll); } }