public override void OnJoinedRoom() { Debug.Log("Joined room"); systemText.ShowText("Joined " + targetScene + "..."); localPlayer = PhotonNetwork.Instantiate(playerPrefab.name, Vector3.zero, Quaternion.identity).GetComponent <Unimotion.Player>(); /*GameCamera camera = Camera.main.GetComponent<GameCamera>(); * camera.socket = localPlayer.cameraSocket;*/ UnityEngine.Events.UnityAction <Scene, LoadSceneMode> tmpDelegate = null; tmpDelegate = delegate(Scene scene, LoadSceneMode mode) { localPlayer.transform.position = Vector3.zero + Vector3.up; localPlayer.transform.rotation = Quaternion.identity; FindObjectOfType <UIManager>().character = localPlayer.GetComponent <Character>(); Unimotion.Player.main = localPlayer; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; SceneManager.sceneLoaded -= tmpDelegate; }; SceneManager.sceneLoaded += tmpDelegate; SceneManager.LoadScene(targetScene); }
/*public void SelectNext() { * selected = Mathf.Clamp(selected + 1, 0, Actions.Length - 1); * } * * public void SelectPrevious() { * selected = Mathf.Clamp(selected - 1, 0, Actions.Length - 1); * }*/ protected void Update() { Collider[] cols = Physics.OverlapSphere(transform.position, 1f, LayerMask.GetMask(new string[] { "Characters" })); bool detected = false; foreach (Collider col in cols) { Unimotion.Player player = col.GetComponent <Unimotion.Player>(); if (player != null && player.photonView.IsMine && IsInteractable) { detected = true; active = this; break; } } if (!detected && active == this) { active = null; } }