/// <summary> /// /// </summary> public void OnExit(bool byDeath = false) { foreach (MonoBehaviour m in VehicleScripts) { m.enabled = false; } if (m_VehicleType == VehicleType.Jet) { JetScript.Immobilize(); } VehicleCamera.SetActive(false); Player.transform.parent = null; Player.transform.position = ExitPoint.position; Vector3 r = ExitPoint.eulerAngles; r.y = transform.eulerAngles.y; Player.transform.rotation = Quaternion.Euler(r); Player.GetComponent <bl_PlayerCar>().OnExitLocal(this, byDeath); LocalInVehicle = false; RemoteInVehicle = false; VehicleUI.OnExit(m_VehicleType); bl_EventHandler.OnLocalPlayerVehicle(false, m_VehicleType); LocalPlayerView.RPC("NetworkCarEvent", PhotonTargets.OthersBuffered, false, m_VehicleType, photonView.viewID, PlayerVisibleInside); view.RPC("InAndOutEvent", PhotonTargets.OthersBuffered, false); }
/// <summary> /// /// </summary> public void OnEnter() { if (view.ownerId != PhotonNetwork.player.ID) { view.RequestOwnership(); } bl_EventHandler.OnLocalPlayerVehicle(true, m_VehicleType); foreach (MonoBehaviour m in VehicleScripts) { m.enabled = true; } if (m_VehicleType == VehicleType.Jet) { JetScript.Reset(); } Player.transform.parent = PlayerHolder; Player.transform.localPosition = DriverPosition; Player.transform.localEulerAngles = DriverRotation; VehicleCamera.SetActive(true); Player.GetComponent <bl_PlayerCar>().OnEnterLocal(this); LocalInVehicle = true; LocalOnTrigger = false; VehicleUI.SetEnterUI(false); VehicleUI.OnEnter(m_VehicleType); LocalPlayerView.RPC("NetworkCarEvent", PhotonTargets.OthersBuffered, true, m_VehicleType, photonView.viewID, PlayerVisibleInside); view.RPC("InAndOutEvent", PhotonTargets.OthersBuffered, true); }
/// <summary> /// /// </summary> public void EnterInSeat() { Seat s = Seats[SeatTriggerID]; bl_EventHandler.OnLocalPlayerVehicle(true, VehicleType.Car); PlayerCar.OnEnterInSeat(this, s); s.CameraView.SetActive(true); Player.transform.parent = VehicleManager.PlayerHolder; Player.transform.localPosition = s.Position; Player.transform.localEulerAngles = s.Rotation; s.isOcuped = true; VehicleUI.SetEnterUI(false); LocalPlayerView.RPC("RpcPassengerEvent", PhotonTargets.OthersBuffered, true, SeatTriggerID, photonView.viewID); }
/// <summary> /// /// </summary> public void ExitSeat(bool byDeath = false) { if (SeatTriggerID < 0) { return; } Seat s = Seats[SeatTriggerID]; Player.transform.parent = null; Player.transform.position = s.ExitPoint.position; Player.transform.rotation = s.ExitPoint.rotation; s.isOcuped = false; s.CameraView.SetActive(false); PlayerCar.OnExitFromSeat(byDeath); bl_EventHandler.OnLocalPlayerVehicle(false, VehicleType.Car); LocalPlayerView.RPC("RpcPassengerEvent", PhotonTargets.OthersBuffered, false, SeatTriggerID, photonView.viewID); }