📚
Deadly Dungeons
  • Initial page
  • Traps
    • Introduction
    • Trap Triggers
    • Raycast Triggers
    • Disabling Traps with Triggers
    • Trap
    • Trap Mechanism
      • Animator
      • Launcher
      • Particle (Trap Mechanism)
      • Physics
    • Effect Handlers
      • Audio Handler
      • Particle (Effect Handler)
      • Ray Handler
      • Custom Effect Handler
    • Damage System
      • Damage Source
      • IDamageable
      • Damage Result
    • Damageable Example
    • Utility
      • AutoConnect Joint
      • Texture Mover
Powered by GitBook
On this page

Was this helpful?

  1. Traps
  2. Damage System

IDamageable

The damage source will use this interface to do damage. Here is a simple implementation of this interface.​

public class ExampleDamageable : MonoBehaviour, IDamageable
{
    public int Health = 100;

    public void TakeDamage(DamageResult result)
    {
        Health -= result.damage;
        if (Health <= 0)
        {       
            // Do something on death
        }
    }
}

PreviousDamage SourceNextDamage Result

Last updated 4 years ago

Was this helpful?