// Checks with player is doing damage and minus the damage done from the other players health public void Damage(CharacterBattle attacker, int damageAmount) { healthSystem.Damage(damageAmount); // CodeMonkey.CMDebug.TextPopup("health " + healthSystem.GetHealthAmount(), GetPosition()); Vector3 dirFromAttacker = (GetPosition() - attacker.GetPosition()).normalized; if (isPlayerTeam) { GameObject.FindGameObjectWithTag("P1Life").GetComponent <Health>().health -= damageAmount; } else { GameObject.FindGameObjectWithTag("P2Life").GetComponent <Health>().health -= damageAmount; } DamagePopup.Create(GetPosition(), damageAmount, false); characterBase.SetColorTint(new Color(1, 0, 0, 1f)); Blood_Handler.SpawnBlood(GetPosition(), dirFromAttacker); if (healthSystem.IsDead()) { // Died Debug.Log("level" + " " + level + " " + "complete"); } }
public void Damage(CharacterBattle attacker, int damageAmount) { healthSystem.Damage(damageAmount); //CodeMonkey.CMDebug.TextPopup("Hit " + healthSystem.GetHealthAmount(), GetPosition()); Vector3 dirFromAttacker = (GetPosition() - attacker.GetPosition()).normalized; DamagePopup.Create(GetPosition(), damageAmount, false); characterBase.SetColorTint(new Color(1, 0, 0, 1f)); Blood_Handler.SpawnBlood(GetPosition(), dirFromAttacker); CodeMonkey.Utils.UtilsClass.ShakeCamera(1f, .1f); if (healthSystem.IsDead()) { // Died characterBase.PlayAnimLyingUp(); } }