Beispiel #1
0
  static QuantumNetworkCommunicator GetCommunicator(DeterministicRuntimeConfig runtimeConfig) {
    if (runtimeConfig.GameMode != DeterministicGameMode.Multiplayer) {
      return null;
    }

    return new QuantumNetworkCommunicator(PhotonNetwork.networkingPeer, false);
  }
Beispiel #2
0
  public static void StartGame(DeterministicRuntimeConfig runtimeConfig) {
    Init();

    CheckRunnerIsFree();

    if (runtimeConfig.GameMode == DeterministicGameMode.Multiplayer) {
      if (PhotonNetwork.connected == false) {
        throw new Exception("Not connected to photon");
      }

      if (PhotonNetwork.inRoom == false) {
        throw new Exception("Can't start networked game when not in a room");
      }

      if (runtimeConfig.MaxPlayers != PhotonNetwork.room.MaxPlayers) {
        throw new Exception("Less RuntimePlayer instances provided on RuntimeConfig than MaxPlayers set on room");
      }
    }

    Current = CreateInstance();
    Current._session = new DeterministicSession(DeterministicSessionConfigAsset.Instance.Config, new ExampleDeterministicGame(runtimeConfig), GetCommunicator(runtimeConfig), runtimeConfig);
  }
 public ExampleDeterministicGame(DeterministicRuntimeConfig runtimeConfig)
 {
     _runtimeConfig = runtimeConfig;
 }