Converting vehicle states to new API 3

This commit is contained in:
in0finite 2019-05-26 00:08:56 +02:00
parent b474d7df85
commit ec4435e181

View file

@ -11,6 +11,12 @@ namespace SanAndreasUnity.Behaviours.Peds.States
{
public override void OnBecameActive()
{
base.OnBecameActive();
this.EnterVehicleInternal();
}
public override void OnBecameInactive()
{
this.Cleanup();
@ -25,11 +31,16 @@ namespace SanAndreasUnity.Behaviours.Peds.States
public void EnterVehicle(Vehicle vehicle, Vehicle.Seat seat)
{
this.CurrentVehicle = vehicle;
this.CurrentVehicleSeat = seat;
m_ped.SwitchState<VehicleSittingState> ();
}
void EnterVehicleInternal()
{
Vehicle vehicle = this.CurrentVehicle;
Vehicle.Seat seat = this.CurrentVehicleSeat;
VehicleEnteringState.PreparePedForVehicle(m_ped, vehicle, seat);
@ -42,13 +53,6 @@ namespace SanAndreasUnity.Behaviours.Peds.States
m_model.PlayAnim(AnimGroup.Car, AnimIndex.SitPassenger, PlayMode.StopAll);
}
// send message to clients
if (m_isServer)
{
foreach(var pedSync in Net.Player.AllPlayers.Select(p => p.GetComponent<Net.PedSync>()))
pedSync.PedEnteredVehicle(m_ped);
}
}