🎨
UVC
  • Introduction
  • Installation
    • Installing in New Project
    • Installing in Existing Project - SCK
    • Installing in Existing Project - MCK
  • Space Combat Kit Tour
  • Mech Combat Kit Tour
  • Player Setup
  • Vehicle Framework
    • Game Agents
    • Vehicles
    • Modules
      • Module Mounts
      • Modules
      • Module Types
      • Module Attachments
      • Display Module On UI
      • Module Managers
  • Input
    • General Input
    • Vehicle Input
    • Rewired Integration
  • Player/AI
  • Spaceships
    • Speed UI
    • Space Fighters
    • Capital Ships
  • Mechs
    • Speed UI
  • Vehicle Control Animations
  • Character Enter/Exit
  • Camera
    • Camera Setup
    • Vehicle Setup
    • Secondary Cameras
    • Death Camera
  • Weapons
    • Framework
      • Triggerables System
      • Weapon System
    • Vehicle Setup
      • Vehicle Weapons
      • Cursor Aiming
    • Projectile Weapons
    • Beam Weapons
    • Missile Weapons
    • Resource Handling (Ammo/Heat)
    • Turrets
    • HUD Weapon Info
    • Health Modifier Volumes
  • Radar
    • Radar Setup
    • Target Setup
    • Target Selectors
    • Trackable Types
    • Improving Radar Performance
    • Target Notification
    • Radar Audio
  • Health
    • Health Framework
      • Health
      • Damageable
      • Damage Receiver
      • Health Modifier
      • Health Types
      • Health Modifier Types
      • Surface Types
    • Vehicle Setup
    • Damageable Object Setup
    • Detonators
    • Health Recharge
    • Health UI
    • Energy Shield
    • Damageable Module Linkers
  • HUD
    • HUD Basics
    • HUD Manager Setup
    • Custom HUD Components
    • HUD Module Display
    • Camera View Management
    • HUD Cursor / Reticle
    • Weapon UI
    • Resource Container UI
    • 2D Radar
    • 3D Radar
    • Target Boxes
    • Target Holograms
    • Minimaps
    • HUD Distance Lookup
  • Loadout
  • AI - Space Combat Kit
    • AI Setup
    • AI Spaceship Behaviours
  • AI - Mech Combat Kit
  • Game States
  • Teams
  • Floating Origin
  • Object Pooling
  • Menus
    • Creating Menus
    • Button Controllers
  • Rumbles
  • Rigidbody Characters [WIP]
  • Utilities [WIP]
    • Object Triggers
    • Shadow Caster Doubles
    • Gimbals
    • Game State Post Process Enabler
  • Objectives
  • Resources System
    • Resource Containers
    • Resource Handlers
    • Resource Container Triggers
    • Module/Vehicle Resource Usage
    • UI
  • Cutscenes
  • URP Upgrading
Powered by GitBook
On this page
  • Toggle Damage
  • Toggle Healing
  • Apply Damage
  • Apply Healing
  • Destroy/Restore
  • Set Health
  • Health Info

Was this helpful?

  1. Health
  2. Health Framework

Damageable

The Damageable component represents a single damageable object with specific health properties. You can customize the health properties in the inspector.

A Damageable component has much the same functionality as the Health component, except that the Health component represents multiple Damageables, while a Damageable only represents itself.

Toggle Damage

To toggle damage in the editor, you can check/uncheck the Is Damageable checkbox in the inspector of the Damageable component.

To toggle it during gameplay, use the following code:

// Make Damageable un-damageable
myDamageable.IsDamageable = false;

// Make Damageable damageable
myDamageable.IsDamageable = true;

Toggle Healing

To toggle healing in the editor, you can check/uncheck the Is Healable checkbox in the inspector of the Damageable component.

To toggle it during gameplay, use the following code:

// Make Damageable un-healable
myDamageable.IsHealable = false;

// Make Damageable healable
myDamageable.IsHealable = true;

Apply Damage

To apply damage to the Damageable, use the following code:

// Apply damage
myDamageable.Damage(damageValue, hitWorldPosition);

Apply Healing

To apply healing to the Damageable, use the following code:

// Apply healing
myDamageable.Heal(healValue, hitWorldPosition);

Destroy/Restore

To destroy or restore the Damageable, use the following code:

// Destroy Damageable
myDamageable.Destroy();

// Restore Damageable
myDamageable.Restore();

Set Health

To set the health of a Damageable component, use the following code:

// Set health
myDamageable.SetHealth(someValue);

Health Info

To query Damageable health information, you can use the following code:

// Get current health
float health = myDamageable.CurrentHealth;

// Get health capacity
float maxHealth = myDamageable.HealthCapacity

// Get current health fraction (0.0 to 1.0, useful for health bars)
float healthFraction = myDamageable.CurrentHealthFraction;
PreviousHealthNextDamage Receiver

Last updated 2 years ago

Was this helpful?