// ================================================================================================================= // === internal ================================================================================================== // update state of 'follow player' and 'free' spectator buttons void UpdateButtonsState() { bool canFollowPlayer = SpectatorCamera.Spectator_CanFollowPlayer(); m_FollowPlayer_Button.SetNewText(FollowingPlayer ? 0502019 : 0502018); m_FollowPlayer_Button.SetDisabled(!canFollowPlayer); Client client = Client.Instance; if (client != null) { bool disable = client.GameState.State == Client.ClientGameState.Running || WaitingForSpawn; bool canSpawn = true; switch (client.GameState.GameType) { case E_MPGameType.DeathMatch: canSpawn = Client.TimeToRespawn <= client.GameState.DMInfo.RestTimeSeconds ? true : false; break; case E_MPGameType.ZoneControl: PlayerPersistantInfo localPPI = PPIManager.Instance.GetLocalPPI(); canSpawn = localPPI.Team != E_Team.None && localPPI.ZoneIndex >= 0 ? true : false; break; default: Debug.LogError("Unknown Game Type "); break; } m_Cancel_Button.SetDisabled(disable); m_Spawn_Button.SetDisabled(disable || !client.IsReadyForSpawn() || GameCloudManager.isBusy || !canSpawn); if (canSpawn == false) { UpdateControlsVisibility(); } } }
void UpdateCamera() { if (State == E_State.Spectator_Free) { // disable camera effects BloodManagerSetNormalizedHealth(); return; } if (State == E_State.Spectator_FollowPlayer) { if (SpectatorCamera.Spectator_CanFollowPlayer()) { if (null == CameraBehaviour) { AgentHuman Owner = SpectatorCamera.SelectNextAgentToFollow(); if (null != Owner) { CameraBehaviour = Owner.GetComponent <CameraBehaviour>(); IgnoredCollider = Owner.CharacterController; if (CameraBehaviour) { Transform desiredTransform = CameraBehaviour.GetDesiredCameraTransform(); if (desiredTransform) { PrevDist = (desiredTransform.position - CameraBehaviour.CameraOrigin.position).magnitude; } } } } else { // already watching one if (!SpectatorCamera.UpdateFollowPlayer()) { GameCamera.ChangeMode(GameCamera.E_State.Spectator_FollowPlayer); } } } else { ChangeStateInternal(E_State.Spectator_Free); } } if (DisabledTime >= Time.timeSinceLevelLoad) { return; } if (Time.deltaTime == 0 || !CameraBehaviour) { return; } //Collide camera // CollideCamera(); CollideCamera5(); }