sync health

This commit is contained in:
in0finite 2019-07-08 16:25:33 +02:00
parent e5ef9e03c7
commit eb7c90f0ab
2 changed files with 7 additions and 2 deletions

View file

@ -34,6 +34,8 @@ namespace SanAndreasUnity.Behaviours
[SyncVar] Vector3 m_net_movementInput;
[SyncVar] Vector3 m_net_heading;
[SyncVar] float m_net_health;
//[SyncVar(hook=nameof(Net_OnWeaponChanged))] GameObject m_net_weaponGameObject;
[SyncVar(hook=nameof(Net_OnWeaponChanged))] int m_net_currentWeaponSlot;
@ -117,6 +119,9 @@ namespace SanAndreasUnity.Behaviours
if (m_net_heading != this.Heading)
m_net_heading = this.Heading;
if (m_net_health != this.Health)
m_net_health = this.Health;
if (this.WeaponHolder.CurrentWeaponSlot != m_net_currentWeaponSlot)
{
m_net_currentWeaponSlot = this.WeaponHolder.CurrentWeaponSlot;
@ -133,6 +138,8 @@ namespace SanAndreasUnity.Behaviours
this.Heading = m_net_heading;
}
this.Health = m_net_health;
}
// send input to server

View file

@ -19,8 +19,6 @@
- add option to remove current weapon - for testing
- sync fire event
- sync health
- gun flash doesn't work on client ?