public DamageNumber SpawnDamageNumber(float dmg, float dmgReduction, Vector3 pos, bool isPlayer = false) { Vector3 randomPos = pos + (Random.onUnitSphere * randomDistance).SetY(yDistance); DamageNumber newNumber = Instantiate(numberPrefab, randomPos, Quaternion.Euler(eulers)); newNumber.SetColor((isPlayer ? playerDefenseGradient : defenseGradient).Evaluate((dmgReduction + 1f) / 2f)); newNumber.SetDamage(Mathf.CeilToInt(dmg)); float sizeT = (Mathf.Clamp(dmg, valueClampMin, valueClampMax) - valueClampMin) / (valueClampMax - valueClampMin); newNumber.SetSize(sizeRamp.Evaluate(sizeT) * (sizeMax - sizeMin) + sizeMin); return(newNumber); }