IHealable - jimdroberts/FishMMO GitHub Wiki

Description

Interface for entities that can be healed by a character or other source. Implement this to allow objects to receive healing.


API Access

Methods

  • void Heal(ICharacter healer, int amount, bool ignoreAchievements = false)

    Applies healing to the entity. healer (ICharacter): The character performing the healing. amount (int): The amount of healing to apply. ignoreAchievements (bool): If true, achievement progress is not affected by this healing event.


Basic Usage

Setup

  1. Implement IHealable on your entity or object class.
  2. Provide logic in the Heal method to handle receiving and processing healing.
  3. Use the interface to allow characters or other sources to apply healing to the entity.

Example

// Example 1: Implementing IHealable
public class Ally : MonoBehaviour, IHealable {
    public void Heal(ICharacter healer, int amount, bool ignoreAchievements = false) {
        // Apply healing logic here
    }
}

// Example 2: Applying healing in gameplay
IHealable target = ally.GetComponent<IHealable>();
target.Heal(player, 30);

Best Practices

  • Always implement the Heal method to handle all relevant healing logic for your entity.
  • Use the ignoreAchievements parameter to control whether healing should affect achievement progress.
  • Use IHealable for all objects that should be affected by healing effects or abilities.
⚠️ **GitHub.com Fallback** ⚠️