1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
using UnityEngine; public class ScaleWithHp : MonoBehaviour { private DamagableEvent dmg; public AnimationCurve curve; private void Start() { dmg = GetComponentInParent<DamagableEvent>(); } private void Update() { base.transform.localScale = Vector3.one * curve.Evaluate(dmg.currentHP); } }