IEnumerator Kill() { yield return(new WaitForSeconds(8)); if (!hasFinished) { if (_movingToNextLevel) { } else { _movingToNextLevel = true; Debug.Log("Kill() called bad!"); //gameManager.PlayerMoveToNextFloor(player); if (isPlayer1 && PM.GetLocalPlayerID() == 1) { gameManager.GetComponent <PhotonView>().RPC("PlayerMoveToNextFloor", RpcTarget.All, player); } if (isPlayer2 && PM.GetLocalPlayerID() == 2) { gameManager.GetComponent <PhotonView>().RPC("PlayerMoveToNextFloor", RpcTarget.All, player); } } } }
public void Update() { if (PM.CurrentServerUserDepth == PhotonArenaManager.ServerDepthLevel.InRoom && isSpawned == false) { playerID = PM.GetLocalPlayerID(); if (playerID == 1) { player1 = PM.SpawnPlayer(new Vector3(1000, 1000, 1000), player1Position.transform.rotation, "Player1").transform; player1.rotation = Quaternion.Euler(new Vector3(0, -45, 0)); player1.tag = "PlayerSelf"; //camera.transform.position = camera1Position.position; //camera2.transform.position = camera2Position.position; player1Camera.targetTexture = null; player2Camera.targetTexture = player1Render; } else if (playerID == 2) { player2 = PM.SpawnPlayer(new Vector3(1000, 1000, 1000), player2Position.transform.rotation, "Player2").transform; player2.rotation = Quaternion.Euler(new Vector3(0, -45, 0)); player2.tag = "PlayerSelf"; //camera.transform.position = camera2Position.position; //camera2.transform.position = camera1Position.position; player1Camera.targetTexture = player1Render; player2Camera.targetTexture = null; } CBUG.Do(playerID + " - Player ID"); isSpawned = true; } if (player1 != null && player2 != null && PM.CurrentServerUserDepth == PhotonArenaManager.ServerDepthLevel.InRoom) { waitingForHUD.SetActive(false); if (!isGameStarted) { countdownMenu.SetActive(true); } } if (PM.CurrentServerUserDepth == PhotonArenaManager.ServerDepthLevel.InRoom && isOtherPlayerGot == false) { if (playerID == 1) { GameObject OtherPlayer = GameObject.FindWithTag("PlayerOther"); if (OtherPlayer != null) { player2 = OtherPlayer.transform; } } else if (playerID == 2) { GameObject OtherPlayer = GameObject.FindWithTag("PlayerOther"); if (OtherPlayer != null) { player1 = OtherPlayer.transform; } } } if (player1 != null && player2 != null && isGameStarted == false) { //countdown start time = Getclockinseconds //if (countdown start time ) if (countdownStartTime == 0) { countdownStartTime = PM.GetClock(); //CBUG.Do("Countdown Started" + countdownStartTime); //CBUG.Do("Countdown Length" + countdownLength); } //CBUG.Do(countdownStartTime - PM.GetClock() + ": Countdown start time - GetClockInSeconds"); if (PM.GetClock() - countdownStartTime >= countdownLength) { isGameStarted = true; gameStartTime = PM.GetClock(); PM.GetRoom().IsVisible = false; PM.GetRoom().IsOpen = false; StartMatch(); countdownText.text = "GO!"; CBUG.Do("Start game!"); } } if (isGameStarted == true && !isGameOver) { playerTime = (PM.GetClock() - gameStartTime) / 1000f; playerTimeHUD.text = Convert.ToInt32(playerTime).ToString(); if (PM.CurrentServerUserDepth == PhotonArenaManager.ServerDepthLevel.Offline || PM.GetRoom().PlayerCount < 2) { QuitGame(); } } }