public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer) { LobbyPlayer lobby = lobbyPlayer.GetComponent <LobbyPlayer>(); NetPlayerController player = gamePlayer.GetComponent <NetPlayerController>(); player.playerName = lobby.playerName; }
private void RegisterPlayerControllerSpawnedOnRemoteClient(int viewID) { PhotonView playerControllerView = PhotonView.Find(viewID); NetPlayerController netPlayerController = playerControllerView.gameObject.AddComponent <NetPlayerController>(); _NetPlayerControllers[viewID] = netPlayerController; }
public string repairTypeHelperText; // TODO: this should be made protected so no one else overrides // Start is called before the first frame update void Awake() { photonView = GetComponent <PhotonView>(); if (photonView.IsMine) { LocalInstance = this; } DontDestroyOnLoad(this); }
private void SpawnPlayer(NetworkConnection conn) { NetPlayerController player = Instantiate(playerPrefab, spawnPoints[numPlayers].position, spawnPoints[numPlayers].rotation).GetComponent <NetPlayerController>(); NetworkServer.AddPlayerForConnection(conn, player.gameObject); player.RpcSetSpawnPoint(spawnPoints[numPlayers - 1].position, spawnPoints[numPlayers - 1].rotation); player.playerNumber = numPlayers; players.Add(player); }
private void Start() { if (GameManager.instance != null) { Init(); } if (isLocalPlayer && isClient) { LocalPlayer = this; StartCoroutine(waitAndAddCards()); } }
private void OnShowCombatResults(object data) { int[] combatData = (int[])data; int playerViewID = combatData[0]; CombatOptionButton.CombatOptions chosenOption = (CombatOptionButton.CombatOptions)combatData[1]; // Show the option chosen by the net player NetPlayerController player = PhotonView.Find(playerViewID).GetComponent <NetPlayerController>(); if (player == null) { return; } // Update the UI with the chosen option ShowChosenOption(chosenOption); }
private IEnumerator RoundEnding() { DisablePlayerControl(); //CalculatePlayerStamina(); roundWinner = null; roundWinner = GetRoundWinner(); if (roundWinner != null) { roundWinner.score++; } gameWinner = GetGameWinner(); Debug.Log("Round ending..."); messageSystem.RpcBroadcastMessage(EndMessage()); messageSystem.RpcUpdateScore(players[0].score, players[1].score); yield return(endWait); }
public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId) { int playerId = -1; for (int i = 0; i < NetGameCtr.Model.Players.Length; i++) { if (!NetGameCtr.TakenId.Contains(i)) { playerId = i; break; } } if (playerId >= 0) { GameObject playerGO = Instantiate(playerPrefab); NetPlayerController netPlayerCtr = playerGO.GetComponent <NetPlayerController>(); NetGameCtr.TakenId.Add(playerId); netPlayerCtr.PlayerId = playerId; netPlayerCtr.Model = NetGameCtr.Model; NetworkServer.AddPlayerForConnection(conn, playerGO, playerControllerId); } }