public void Init(IDeath iDeath) { _iDeath = iDeath; _entityStats.CalculFinalStats(); _baseHP = _entityStats.HP; _currentHP = _baseHP; }
public void TakeDamage(int damage) { CurrentHealth -= damage; if (CurrentHealth > 0) { return; } IGiveScore obj = GetComponent <IGiveScore>(); if (obj != null) { obj.GiveScore(); } IDeath death = GetComponent <IDeath>(); if (death != null) { death.Destroy(); } if (deathEffect != null) { SimplePool.Spawn(deathEffect.gameObject, transform.position, Quaternion.identity); } Destroy(gameObject); }
public void Init(float health, float defense, IDeath mortalObj) { m_health = health; m_defense = defense; m_mortalObj = mortalObj; ResetHealth(); }
public bool DeathOf(IPlayer player, out IDeath death) { death = default; death = AllDeaths().FirstOrDefault(death => death.Victim == player); return(death != default); }
private void OnCollisionEnter(Collision collision) { IDeath deathTarget = collision.gameObject.GetComponent <IDeath>(); if (deathTarget != null) { deathTarget.DoDeath(); } }
/// <summary> /// When the ball dies by an attack, it destroyes the owner as long as an owner exists. If the ball /// is deactivated or destroyed, this method is not called. You must use the attack system for /// this component to work. /// </summary> private void OnDeath(GameObject killer) { if (Owner != null) { IDeath death = Owner.GetComponent <IDeath>(); if (death != null) { death.Die(killer); } } }
private void Awake() { deathInterface = GetComponent <IDeath>(); }
/// <summary> /// Obtain he death actions on this character /// </summary> void getDeathType() { death = GetComponent <IDeath>(); }
private void Awake() { body = GetComponent <Rigidbody2D>(); deathInterface = GetComponent <IDeath>(); }
private void Awake() { death = GetComponent <IDeath>(); death.Death += ReturnObjectToPool; }
private void Awake() { _currentHealth = maxHealth; _death = GetComponent <IDeath>(); }