using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Saltosion.OneWeapon { [RequireComponent(typeof(Explodable))] public class ExplodableHealth : MonoBehaviour { public float MaxHealth; public float CurrentHealth; private Explodable Explodable; private void Start() { Explodable = GetComponent(); } public void Damage(float amount, Vector2 fromDirection) { BloodLauncher.Splatter(transform.position, -fromDirection, (int)(10 * amount), 100f, 100); MaxHealth -= amount; if (MaxHealth <= 0) { MaxHealth = 0; Explodable.Explode(true); } } } }