mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-03-05 07:37:17 +00:00
move method to other class
This commit is contained in:
parent
7de0dd7cdb
commit
d34ab7d4fe
4 changed files with 25 additions and 25 deletions
Assets/Scripts/Behaviours/Ped/States
|
@ -106,6 +106,27 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
}
|
||||
|
||||
public static void PreparePedForVehicle(Ped ped, Vehicle vehicle, Vehicle.Seat seat)
|
||||
{
|
||||
|
||||
seat.OccupyingPed = ped;
|
||||
|
||||
ped.characterController.enabled = false;
|
||||
|
||||
|
||||
ped.transform.SetParent(seat.Parent);
|
||||
ped.transform.localPosition = Vector3.zero;
|
||||
ped.transform.localRotation = Quaternion.identity;
|
||||
|
||||
ped.PlayerModel.IsInVehicle = true;
|
||||
|
||||
if (!VehicleManager.Instance.syncPedTransformWhileInVehicle) {
|
||||
if (ped.NetTransform != null)
|
||||
ped.NetTransform.enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void Cleanup()
|
||||
{
|
||||
if (!m_ped.IsInVehicle)
|
||||
|
@ -124,7 +145,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
this.CurrentVehicle = null;
|
||||
this.CurrentVehicleSeatAlignment = Vehicle.SeatAlignment.None;
|
||||
m_currentVehicleNetId = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,27 +35,6 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
base.OnBecameInactive();
|
||||
}
|
||||
|
||||
public static void PreparePedForVehicle(Ped ped, Vehicle vehicle, Vehicle.Seat seat)
|
||||
{
|
||||
|
||||
seat.OccupyingPed = ped;
|
||||
|
||||
ped.characterController.enabled = false;
|
||||
|
||||
|
||||
ped.transform.SetParent(seat.Parent);
|
||||
ped.transform.localPosition = Vector3.zero;
|
||||
ped.transform.localRotation = Quaternion.identity;
|
||||
|
||||
ped.PlayerModel.IsInVehicle = true;
|
||||
|
||||
if (!VehicleManager.Instance.syncPedTransformWhileInVehicle) {
|
||||
if (ped.NetTransform != null)
|
||||
ped.NetTransform.enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool TryEnterVehicle(Vehicle vehicle, Vehicle.SeatAlignment seatAlignment, bool immediate = false)
|
||||
{
|
||||
Net.NetStatus.ThrowIfNotOnServer();
|
||||
|
@ -87,7 +66,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
bool immediate = m_immediate;
|
||||
|
||||
|
||||
PreparePedForVehicle(m_ped, vehicle, seat);
|
||||
BaseVehicleState.PreparePedForVehicle(m_ped, vehicle, seat);
|
||||
|
||||
if (seat.IsDriver)
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
void ExitVehicleInternal()
|
||||
{
|
||||
VehicleEnteringState.PreparePedForVehicle(m_ped, this.CurrentVehicle, this.CurrentVehicleSeat);
|
||||
BaseVehicleState.PreparePedForVehicle(m_ped, this.CurrentVehicle, this.CurrentVehicleSeat);
|
||||
|
||||
// TODO: no need for this, vehicle should know when there is no driver
|
||||
// TODO: but, right now, this should be included in cleanup
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
Vehicle vehicle = this.CurrentVehicle;
|
||||
Vehicle.Seat seat = this.CurrentVehicleSeat;
|
||||
|
||||
VehicleEnteringState.PreparePedForVehicle(m_ped, vehicle, seat);
|
||||
BaseVehicleState.PreparePedForVehicle(m_ped, vehicle, seat);
|
||||
|
||||
this.UpdateAnimsWhilePassenger();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue