Ejemplo n.º 1
0
 public void EndTurn()
 {
     if (!isServer)
     {
         return;
     }
     for (var i = 0; i < characters.Length - 1; i++)
     {
         var character = characters[i];
         if (turningCharacter.GetInstanceID() == character.GetInstanceID())
         {
             var nextCharacter = characters[i == characters.Length - 1 ? 0 : i + 1];
             turningCharacter      = nextCharacter;
             turningCharacterNetId = nextCharacter.netId.Value;
             break;
         }
     }
     // Stop countdown
     _race.GetModule <CountdownNetworkModule>(x => {
         x.Stop();
     });
     // Callback end-turning in server
     EventManager.TriggerEvent(Constants.EVENT_REFEREE_SERVER_ENDTURNED, new { turningCharacter = this.turningCharacter });
     // Callback end-turning to client
     RpcEndTurnCallback(turningCharacter.netId.Value);
 }