mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-12-04 01:39:11 +00:00
Working on vehicle networking
This commit is contained in:
parent
ad2c8c9010
commit
c38c386563
1 changed files with 17 additions and 2 deletions
|
@ -1,19 +1,34 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using SanAndreasUnity.Net;
|
using SanAndreasUnity.Net;
|
||||||
|
using Mirror;
|
||||||
|
|
||||||
namespace SanAndreasUnity.Behaviours.Vehicles
|
namespace SanAndreasUnity.Behaviours.Vehicles
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(Vehicle))]
|
|
||||||
public class VehicleController : MonoBehaviour
|
public class VehicleController : NetworkBehaviour
|
||||||
{
|
{
|
||||||
private Vehicle m_vehicle;
|
private Vehicle m_vehicle;
|
||||||
|
|
||||||
|
[SyncVar] int m_net_id = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
m_vehicle = GetComponent<Vehicle>();
|
m_vehicle = GetComponent<Vehicle>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnStartClient()
|
||||||
|
{
|
||||||
|
base.OnStartClient();
|
||||||
|
|
||||||
|
if (!NetStatus.IsServer)
|
||||||
|
{
|
||||||
|
// load vehicle on clients
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue