From a5b8e5c51c0dbe1f767727115c2cee9f2c59ae8a Mon Sep 17 00:00:00 2001 From: in0finite Date: Wed, 24 Apr 2019 02:50:28 +0200 Subject: [PATCH] Working on ped networking 2 --- Assets/Scripts/Behaviours/Ped/Ped.cs | 2 ++ Assets/Scripts/Behaviours/Ped/Ped_Networking.cs | 10 ++++++++++ Assets/Scripts/Behaviours/Weapon.cs | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/Assets/Scripts/Behaviours/Ped/Ped.cs b/Assets/Scripts/Behaviours/Ped/Ped.cs index 766e4151..541decf2 100644 --- a/Assets/Scripts/Behaviours/Ped/Ped.cs +++ b/Assets/Scripts/Behaviours/Ped/Ped.cs @@ -387,6 +387,8 @@ namespace SanAndreasUnity.Behaviours this.UpdateDamageStuff (); + this.Update_Net(); + // IsWalking = IsRunning = false; if (this.CurrentState != null) diff --git a/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs b/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs index 1d9d21e1..e4c27856 100644 --- a/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs +++ b/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs @@ -22,6 +22,16 @@ namespace SanAndreasUnity.Behaviours } + public override void OnStartClient() + { + base.OnStartClient(); + + if (this.isServer) + return; + + this.PlayerModel.Load(m_net_pedId); + } + void Update_Net() { m_net_pedId = this.PedDef.Id; diff --git a/Assets/Scripts/Behaviours/Weapon.cs b/Assets/Scripts/Behaviours/Weapon.cs index be9c5f44..edad9acf 100644 --- a/Assets/Scripts/Behaviours/Weapon.cs +++ b/Assets/Scripts/Behaviours/Weapon.cs @@ -137,6 +137,14 @@ namespace SanAndreasUnity.Behaviours // used to play weapon sound AudioSource m_audioSource; + /* + #region SyncVars + [SyncVar] int m_net_id = 0; + [SyncVar] int m_net_ammoInClip = 0; + [SyncVar] int m_net_ammoOutsideOfClip = 0; + #endregion + */ + static Weapon ()