예제 #1
0
    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);
    }
예제 #2
0
    private void OnJoinedRoom()
    {
        PersistentController.ClearStatus();

        if (SceneManagerHelper.ActiveSceneName != "Main" && PhotonNetwork.connected)
        {
            PhotonNetwork.isMessageQueueRunning = false;
            SceneManager.LoadScene("Main");
        }
    }
    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()
    {
        if (_PersistentController != null)
        {
            GameObject.Destroy(this.gameObject);
            return;
        }

        Debug.Log(string.Format("\"{0}\" version {1} started.", Application.productName, Application.version));

        GameObject.DontDestroyOnLoad(this);

        PersistentController._PersistentController = this;

        PersistentController.statusList     = new List <string>();
        PersistentController.lblStatus      = transform.FindChild("lblStatus").GetComponent <Text>();
        PersistentController.lblStatus.text = string.Empty;
    }
 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);
     }
 }
예제 #7
0
 private void OnPhotonJoinRoomFailed()
 {
     PersistentController.AddStatus("Could not join room. (Is it full?)", true);
     PhotonNetwork.Disconnect();
 }