Working on vehicle sync

This commit is contained in:
in0finite 2019-04-28 22:57:04 +02:00
parent f9e89e25ea
commit 09b1bfae30
3 changed files with 22 additions and 3 deletions

View file

@ -11,8 +11,15 @@ namespace SanAndreasUnity.Behaviours.Peds.States
{
public override void OnBecameActive() {
public override void OnBecameInactive()
{
// restore everything
m_ped.characterController.enabled = true;
// restore seat's occupying ped ? - no
m_ped.transform.SetParent(null, true);
m_model.IsInVehicle = false;
}
public bool TryEnterVehicle(Vehicle vehicle, Vehicle.SeatAlignment seatAlignment, bool immediate = false)
@ -47,8 +54,9 @@ namespace SanAndreasUnity.Behaviours.Peds.States
m_ped.transform.localPosition = Vector3.zero;
m_ped.transform.localRotation = Quaternion.identity;
if (m_ped.IsControlledByLocalPlayer && seat.IsDriver)
if (seat.IsDriver)
{
// TODO: this should be done when ped enters the car
vehicle.StartControlling();
}

View file

@ -67,5 +67,14 @@ namespace SanAndreasUnity.Net
m_ped.OnCrouchButtonPressed();
}
public void PedStartedEnteringVehicle()
{
NetStatus.ThrowIfNotOnServer();
// send rpc to clients
// include params: vehicle, seat
}
}
}

View file

@ -10,6 +10,8 @@
- send button input events to server:
- When ped enters vehicle, he changes parent. Is this allowed in Mirror ? Possible solution would be to only change parent of ped model.
- stats window
- display a message to user when network is stopped