IHealable - jimdroberts/FishMMO GitHub Wiki
Interface for entities that can be healed by a character or other source. Implement this to allow objects to receive healing.
-
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.
- Implement IHealable on your entity or object class.
- Provide logic in the Heal method to handle receiving and processing healing.
- Use the interface to allow characters or other sources to apply healing to the entity.
// 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);
- 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.