I am currently trying to sync the health of the monster in my game but as both users attack the monster, the monster health receives the flip flop effect where the hp jumps since the other players has a different value.
IEnumerator callSyncHP()
{
if (lastHP != stats.Health) {
tno.Send ("syncHP", TNet.Target.AllSaved, stats.Health);
lastHP = stats.Health;
}
yield return new WaitForSeconds
(0
.2f
); StartCoroutine (callSyncHP ());
}
[RFC]
void syncHP(int hp)
{
stats.Health = hp;
}