/// <summary> /// Called upon entering the death state on the client, where we show the death UI. /// We will focus the camera and death UI on the player who last hit us. If no player /// last hit us (e.g. we crashed into many buildings), it will focus on the current player. /// </summary> /// <param name="optionalData">Should be null</param> public override void Enter(object optionalData = null) { deathView.Show(); originalCameraType = ClientStateMachine.Singleton.PrimaryCamera.CamType; IReadOnlyList <GameObject> zombieCarGOs = ClientStateMachine.Singleton.LocalPlayer.ZombieCarGOs; CarManager car = zombieCarGOs[zombieCarGOs.Count - 1].GetComponent <CarManager>(); // The last element in the list is the most recent car which died. Player killer = car.LastHitByPlayer; if (killer != null) { bool showRevengeInstruction = car.CarType == CarManager.CarTypeEnum.Racer; deathInfoUIComponent.UpdateDeathInfo(killer.PlayerName, showRevengeInstruction); if (killer.Car != null) { ClientStateMachine.Singleton.PrimaryCamera.SetTarget(killer.Car.transform, PrimaryCamera.CameraType.Death); } } else { deathInfoUIComponent.UpdateDeathInfo(null, false); ClientStateMachine.Singleton.PrimaryCamera.SetTarget(car.transform, PrimaryCamera.CameraType.Death); } TransitionAfterWaitingPeriod(); allowTransition = true; }
/// <summary> /// Given the current state of the primary camera, /// update the caption so the user knows what camera /// type is currently being used. /// </summary> /// <param name="cameraType">The current type the primary camera is set to.</param> public void UpdateCameraInfo(PrimaryCamera.CameraType cameraType) { switch (cameraType) { case PrimaryCamera.CameraType.Overhead: cameraInfoTMP.text = "Overhead"; break; case PrimaryCamera.CameraType.ThirdPerson: cameraInfoTMP.text = "Third person"; break; case PrimaryCamera.CameraType.Death: cameraInfoTMP.text = "Death"; break; } }