public void RoundStartFun(int unitId) { Debug.Log("RPC_RoundStart"); TimeFrozen = false; _roundStart = Time.time; var foundUnit = ApplicationModel.MatchModel.Units.First(u => u.Id == unitId); if (!PhotonHelper.PlayerIsSinglePlayer()) { MatchController.SetCurrentUnit(foundUnit); } if (foundUnit.Color == GetCurrentPlayerColor() && GetCurrentPlayer().Name == PhotonNetwork.NickName) { foundUnit.SetAllowControll(true); foundUnit.SetScopeVisibility(true); } else { foundUnit.SetAllowControll(false); foundUnit.SetScopeVisibility(false); } CameraService.SetCameraFollowAndRotationTarget(foundUnit.gameObject.transform); CurrentWeaponController.ResetPower(); CurrentWeaponController.SetCurrentWeapon(ShootService.GetNoneWeapon()); if (RoundChangedEvent != null) { RoundChangedEvent.Invoke(this, new EventArgs()); } EndMatchIfNeeded(); }
private void CheckIfShouldEndRound() { if (PhotonHelper.PlayerIsMultiplayerHost() || PhotonHelper.PlayerIsSinglePlayer()) { if (ShouldRoundEnd(GameObjectsProviderService.CurrentWeaponController.GetCurrentWeapon())) { GameObjectsProviderService.MainPhotonView.RPC("RPC_SetTimeTo3Sec", RpcTarget.Others); GameObjectsProviderService.MainGameController.SetTimeTo3Sec(); } } }