Working on vehicle networking

This commit is contained in:
in0finite 2019-04-30 00:18:19 +02:00
parent ad2c8c9010
commit c38c386563

View file

@ -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()
{ {