mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-15 00:37:09 +00:00
Working on vehicle sync 3
This commit is contained in:
parent
b89e365619
commit
6472f3c73e
2 changed files with 15 additions and 11 deletions
|
@ -3,6 +3,7 @@ using SanAndreasUnity.Utilities;
|
|||
using SanAndreasUnity.Behaviours.Vehicles;
|
||||
using SanAndreasUnity.Behaviours.World;
|
||||
using SanAndreasUnity.Importing.Animation;
|
||||
using System.Linq;
|
||||
|
||||
namespace SanAndreasUnity.Behaviours.Peds.States
|
||||
{
|
||||
|
@ -43,7 +44,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
return true;
|
||||
}
|
||||
|
||||
void EnterVehicle(Vehicle vehicle, Vehicle.SeatAlignment seatAlignment, bool immediate = false)
|
||||
void EnterVehicle(Vehicle vehicle, Vehicle.SeatAlignment seatAlignment, bool immediate)
|
||||
{
|
||||
|
||||
Vehicle.Seat seat = vehicle.GetSeat (seatAlignment);
|
||||
|
@ -78,8 +79,14 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
|
||||
// send message to clients
|
||||
if (!immediate)
|
||||
Net.PedSync.Local.PedStartedEnteringVehicle();
|
||||
if (m_isServer)
|
||||
{
|
||||
if (!immediate)
|
||||
{
|
||||
foreach(var pedSync in Net.Player.AllPlayers.Select(p => p.GetComponent<Net.PedSync>()))
|
||||
pedSync.PedStartedEnteringVehicle(m_ped);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_coroutine = StartCoroutine (EnterVehicleAnimation (seat, immediate));
|
||||
|
@ -110,11 +117,8 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
// ped now completely entered the vehicle
|
||||
|
||||
// call method from VehicleSittingState - he will switch state
|
||||
m_ped.GetStateOrLogError<VehicleSittingState> ().EnterVehicle(this.CurrentVehicle, seat);
|
||||
|
||||
// this variable is not needed - it can be obtained based on current state
|
||||
// IsInVehicleSeat = true;
|
||||
|
||||
if (m_isServer)
|
||||
m_ped.GetStateOrLogError<VehicleSittingState> ().EnterVehicle(this.CurrentVehicle, seat);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace SanAndreasUnity.Net
|
|||
m_ped.OnCrouchButtonPressed();
|
||||
}
|
||||
|
||||
public void PedStartedEnteringVehicle()
|
||||
public void PedStartedEnteringVehicle(Ped ped)
|
||||
{
|
||||
NetStatus.ThrowIfNotOnServer();
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace SanAndreasUnity.Net
|
|||
|
||||
}
|
||||
|
||||
public void PedEnteredVehicle()
|
||||
public void PedEnteredVehicle(Ped ped)
|
||||
{
|
||||
NetStatus.ThrowIfNotOnServer();
|
||||
|
||||
|
@ -85,7 +85,7 @@ namespace SanAndreasUnity.Net
|
|||
|
||||
}
|
||||
|
||||
public void PedStartedExitingVehicle()
|
||||
public void PedStartedExitingVehicle(Ped ped)
|
||||
{
|
||||
NetStatus.ThrowIfNotOnServer();
|
||||
|
||||
|
|
Loading…
Reference in a new issue