using UnityEngine;
using System.Collections;
namespace UnityStandardAssets.Characters.FirstPerson{
public class Networking : Photon.MonoBehaviour {
// Use this for initialization
void Start () {
PhotonNetwork.ConnectUsingSettings ("RP_v013");
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
enabled = photonView.isMine;
}
// Update is called once per frame
void Update () {
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
}
void OnGUI() {
GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
if (Input.GetKey(KeyCode.Escape))
{
PhotonNetwork.LoadLevel("MainMenu");
}
}
void OnConnectedToMaster() {
PhotonNetwork.JoinRandomRoom ();
}
void OnPhotonRandomJoinFailed() {
PhotonNetwork.CreateRoom (null);
}
void OnJoinedRoom() {
GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate ("PlayerPrefab", Vector3.zero, Quaternion.identity, 0);
PhotonNetwork.automaticallySyncScene = true;
}
}
}