private void Start() { if (_GameController != null) { GameObject.Destroy(this.gameObject); return; } _GameController = this; PhotonNetwork.isMessageQueueRunning = true; if (!PhotonNetwork.connected && !atSchool) { SceneManager.LoadScene("MainMenu"); if (!Application.isEditor) { PersistentController.AddStatus("Attempted to start game with no connection!", true); } return; } xy_wall = (GameObject)Resources.Load <GameObject>("Wallxy"); yz_wall = (GameObject)Resources.Load <GameObject>("Wallyz"); int id = CreatePlayer(); //GenerateLevel(id); }
public void btnPlay_Click() { if (GameController.atSchool) { SceneManager.LoadScene("Main"); PersistentController.AddStatus("At School Mode"); return; } PersistentController._NetworkController.Connect(); }
private void Update() { // TODO: There has to be a better way of doing this... string curr = PhotonNetwork.connectionStateDetailed.ToString(); if (curr != oldState) { PersistentController.AddStatus(curr); } oldState = curr; }
private void Awake() { _PhotonView = GetComponent <PhotonView>(); if (_PhotonView.isMine) { ExitGames.Client.Photon.Hashtable props = new ExitGames.Client.Photon.Hashtable(); props.Add("ID", PhotonNetwork.room.playerCount - 1); PhotonNetwork.player.SetCustomProperties(props); PhotonNetwork.OnEventCall += this.OnEvent; PersistentController.AddStatus(string.Format("You joined with ID {0}", PhotonNetwork.player.customProperties["ID"])); Leaderboards.id = (int)PhotonNetwork.player.customProperties["ID"]; mainID = (int)PhotonNetwork.player.customProperties["ID"]; this.gui = GameObject.Find("Health"); health = MAXIMUM_HEALTH; UpdateHealth(); pauseMenu = GameObject.Find("PauseMenu"); pauseMenu.SetActive(paused = false); } }
private void OnPhotonJoinRoomFailed() { PersistentController.AddStatus("Could not join room. (Is it full?)", true); PhotonNetwork.Disconnect(); }