Ejemplo n.º 1
0
 public void DelayCancel()
 {
     // public function paired to cancel button in waiting room scene
     chatHandler.DisconnectFromChat();
     Destroy(infoObject.gameObject);
     Destroy(chatController.gameObject);
     Destroy(chatHandler.gameObject);
     Destroy(logHandler.gameObject);
     PhotonNetwork.LeaveRoom(true);
     SceneManager.LoadScene(menuSceneIndex);
 }
Ejemplo n.º 2
0
    private void Update()
    {
        // if the player presses the tab and Q key, then we will be brought back to the main menu scene
        // only gets called if player is playing online, not if testing via scene
        if (Input.GetKey("tab") && Input.GetKeyDown("q") || Input.GetKey("q") && Input.GetKeyDown("tab"))
        {
            if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom)
            {
                chatHandler.DisconnectFromChat();
                Destroy(infoObject.gameObject);
                Destroy(chatHandler.gameObject);
                Destroy(timerController.gameObject);
                Destroy(gameData.gameObject);
                Destroy(logHandler.gameObject);
                SceneManager.LoadScene(0);
                PhotonNetwork.LeaveRoom(true);
                Debug.Log("Leaving the photon room");
            }
        }

        // this is for making the player zoom in and out of the map, so that they can view their map or the full screen
        // if it's in full screen though then they can't move around, that is handled in each character's script though
        if (Input.GetKey("tab") && Input.GetKeyDown("m") || Input.GetKey("m") && Input.GetKeyDown("tab"))
        {
            if (isInPlayerMap)
            {
                // if not online then photonView.IsMine will fail but the second will work, the second is meant for testing purposes
                if (photonView.IsMine || !PhotonNetwork.IsConnected)
                {
                    this.GetComponentInChildren <Camera>().enabled = false;
                }
                isInPlayerMap = false;
            }
            else
            {
                if (photonView.IsMine || !PhotonNetwork.IsConnected)
                {
                    this.GetComponentInChildren <Camera>().enabled = true;
                }
                isInPlayerMap = true;
            }
        }
    }