internal void UpdateHealth(string[] splitCode) { int id = int.Parse(splitCode[1]); int shooterID = int.Parse(splitCode[3]); float currentHealth = float.Parse(splitCode[2]); IHaveHealth target = network.GetPlayerOfID(id).GetComponent(typeof(IHaveHealth)) as IHaveHealth; float damage = target.GetHealth() - currentHealth; target?.TakeDamage(damage, shooterID); if (shooterID * -1 == _myID) { target?.SimulateDamage(network.GetPlayerOfID(id).transform.position + Vector3.up, damage); } }
public void TakeDamage(float damage, int shooterID = -1) { Debug.LogWarning("headshot"); parentHealth.TakeDamage(damage * headshotMultiplier, shooterID); }