/// <summary> /// Damages the object /// </summary> /// <param name="inflictor">The GameObj that inflicted the damage</param> /// <param name="source">The GameObj that caused the damage</param> /// <param name="damage">The amount of damage to be dealt</param> /// <returns>Returns the amount of damage actually dealt. (Or -1 if the damage was cancelled)</returns> public virtual int Damage(GameObj inflictor, GameObj source, int damage) { health -= damage; if (health <= 0) { Die(inflictor, source); } return(damage); }
/// <summary> /// Destroys the object /// </summary> /// <param name="inflictor">The GameObj that destroyed the object</param> /// <param name="source">The GameObj that caused the object's destruction</param> public virtual void Die(GameObj inflictor, GameObj source) { flags |= ActorFlags.Killed; }