private void FixedUpdate() { //Pause check if (SceneManager.GetActiveScene().name.Contains("Level")) { if (photonView.IsMine) { if (!cameraset) { //Find camera playerCamera = Camera.main.GetComponent <PlayerCamera>(); //If photonview is your //Set player target playerCamera.player = transform; cameraset = true; //Debug.Log("cameraset = true"); } if (!LevelsManager.Instance.isPause) { Move(); Animation(CheckInput("").x, CheckInput("").y); } } else //if is another player { SmoothMove(); } } }
//Reset position after entering lobby IEnumerator WaitforPositionReset() { SetPlayersPositions(1); SyncPlayerUI(); if (PlayerNetwork.Instance.myCharacter == 0) { playerCamera = Camera.main.GetComponent <PlayerCamera>(); playerCamera.player = components.players[0].transform; } else { playerCamera = Camera.main.GetComponent <PlayerCamera>(); playerCamera.player = components.players[1].transform; } if (PlayerNetwork.Instance.myCharacter == 0) { components.BlindView.TurnBlack("Untagged"); components.BlindView.TurnBlack("Background"); components.BlindView.TurnBlack("Floor"); components.BlindView.TurnBlack("Player"); components.BlindView.TurnOpposite("Item"); components.BlindView.TurnOpposite("SoundSource"); components.BlindView.TurnOpposite("SoundSourceComp"); } else if (PlayerNetwork.Instance.myCharacter == 1) { AudioListener.volume = 0; } yield return(new WaitForSeconds(0.5f)); PlayerNetwork.Instance.photonView.RPC("RPC_FinishLevelPositionSet", RpcTarget.MasterClient); foreach (GameObject x in components.SoundsSetup) { x.GetComponent <AudioSource>().Play(); } components.LevelAManager.isGame = true; }