public void CalculatePoints() { List <int> allPoints = new List <int>(); int highestPoints; for (int i = 0; i < NetworkCallback.GetPlayers().Count; i++) { allPoints.Add(NetworkCallback.GetPlayers()[i].GetComponent <NetworkPlayer>().GetPoints()); // if (player.playerState != null) //{ highestPoints = Mathf.Max(allPoints.ToArray()); Debug.Log(highestPoints); /* * if (player.playerState.PlayerScore >= highestScore) * { * highestScore = player.playerState.PlayerScore; * highestScoringPlayer = player.networkPlayer; * highestScoringPlayerState = player.playerState; * } */ //} } }
// Update is called once per frame void FixedUpdate() { if (NetworkCallback.GetPlayers()[0]) { if (NetworkCallback.GetPlayers()[0].GetComponent <NetworkPlayer>().isVictory) { diceButton.GetComponent <Button>().interactable = false; } } if (NetworkCallback.GetPlayers()[1]) { if (NetworkCallback.GetPlayers()[1].GetComponent <NetworkPlayer>().isVictory) { diceButton.GetComponent <Button>().interactable = false; } } /* * Debug.LogWarning(NetworkCallback.GetPlayers()[0].GetComponent<NetworkPlayer>().transform.position); * if(NetworkCallback.GetPlayers().Count == 2) * Debug.LogWarning(NetworkCallback.GetPlayers()[1].GetComponent<NetworkPlayer>().transform.position); * /* * for (int i = 0; i < NetworkCallback.GetPlayers().Count; i++) * { * if (NetworkCallback.GetPlayers().Where(c => c.GetComponent<NetworkPlayer>().isReady).Count() == 0) { * for (int j = 0; j < NetworkCallback.GetPlayers().Count; j++) * { * diceButton.GetComponent<Button>().interactable = true; * } * } * Debug.Log(NetworkCallback.GetPlayers().Where(c => c.GetComponent<NetworkPlayer>().isReady).Count()); * } */ }
// Update is called once per frame void Update() { /* * Debug.LogError(TutorialPlayerObjectRegistry.players[0].character.GetComponent<NetworkPlayer>().isReady) ; * if (TutorialPlayerObjectRegistry.players.Count == 2) { * Debug.LogError(TutorialPlayerObjectRegistry.players[1].character.GetComponent<NetworkPlayer>().isReady); * } * if (TutorialPlayerObjectRegistry.players[0].character); */ if (PlayerInstance.instance.isFinished == true) { PlayerInstance.instance.trophies = timer; if (NetworkCallback.GetPlayers()[0].GetComponent <NetworkPlayer>().isReady) { if (NetworkCallback.GetBool().TrueForAll(x => x) == true) { //PlayerInstance.instance.isReady = false; List <int> scoreList = NetworkCallback.GetScore().OrderBy(l => l).ToList <int>(); if (scoreList[0] != 0) { if (PlayerInstance.instance.trophies == scoreList[0]) { RoundSystem.Instance.MoveForward(2); PlayerInstance.instance.isReady = false; SceneManager.UnloadSceneAsync(2); } else if (PlayerInstance.instance.trophies == scoreList[1]) { RoundSystem.Instance.MoveForward(1); PlayerInstance.instance.isReady = false; SceneManager.UnloadSceneAsync(2); } else { PlayerInstance.instance.isReady = false; SceneManager.UnloadSceneAsync(2); } } } } } else { timer++; } distance.text = timer.ToString(); }