private void RemoveHealth(int id) { if (_healths.Remove(id)) { OnKilled?.Invoke(id); } }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region Methods ////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Kill this entity /// </summary> public void Kill() { IsAlive = false; // Call event handler, if one has been set OnKilled?.Invoke(this, EventArgs.Empty); }
private void Kill() { OnKilled?.Invoke(Id); OnKilled = null; OnDamage = null; }
public void Kill(Vector2 position, float force) { Debug.Assert(_isAlive); DisableBody(); _isAlive = false; OnKilled?.Invoke(this, null); }
public void Kill() { OnKilled?.Invoke(); var sprite = GetComponent <SpriteRenderer>(); var sequence = DOTween.Sequence(); sequence .Append(sprite.DOFade(0f, 0.2f)) .AppendCallback(() => Destroy(gameObject)); }
public void DealDamage(int damage) { health = Mathf.Max(health - damage, 0); if (health == 0) { OnKilled?.Invoke(enemyData); Destroy(gameObject); } }
public void Kill(CreatureObject killer) { lock (this) { if (_dead) { return; } _dead = true; } OnKilled?.Invoke(killer); }
public void TakeDamage(int amount) { CurHp -= amount; if (CurHp < 0) { CurHp = 0; } OnDamage?.Invoke(CurHp, MaxHp); if (CurHp == 0) { OnKilled?.Invoke(Id); } }
public void Kill(Vector3 force) { transform.parent = null; _rb.isKinematic = false; _rb.useGravity = true; _col.isTrigger = false; foreach (MeshRenderer renderer in _models) { renderer.gameObject.layer = 0; } _rb.AddForce(force, ForceMode.Impulse); if (OnKilled != null) { OnKilled.Invoke(); } }
public void Damage(int damageAmount) { for (int i = hearts.Count - 1; i >= 0; i--) { var heart = hearts[i]; if (damageAmount > heart.GetHeartFragments()) { damageAmount -= heart.GetHeartFragments(); heart.Damage(heart.GetHeartFragments()); } else { heart.Damage(damageAmount); break; } } OnDamaged?.Invoke(this, EventArgs.Empty); if (IsDead()) { OnKilled?.Invoke(this, EventArgs.Empty); } }
private void RaiseOnKilledEvent() { OnKilled?.Invoke(this, new System.EventArgs()); }
public static void MonsterKilled(User.User user, IMonster monster) { OnKilled?.Invoke(user, monster); }
public virtual void Kill() { OnKilled?.Invoke(); }
private void KillFighter() { OnKilled?.Invoke(gameObject.name, lastDamagedByFighterID); Destroy(gameObject); }
private void RaiseOnKilledEvent() // Function to notify other classes that the entity died { OnKilled?.Invoke(this, new System.EventArgs()); }
private void RaiseOnKilledEvent() { //If there are any subscribers to OnKilled event, raise the event. Any subscribers will know if //a livingentity gets killed OnKilled?.Invoke(this, new System.EventArgs()); }