private void CreateFloatingDamage(int damageValue) { Debug.Assert(this.floatingTextPrefab != null); GameObject floatingDamageInstance = Instantiate(this.floatingTextPrefab, transform.position, Quaternion.identity); FloatingText theFloatingText = floatingDamageInstance.GetComponent <FloatingText>(); theFloatingText.InitBounceDmg(damageValue); theFloatingText.text.color = Color.Lerp(Color.yellow, Color.red, (float)damageValue / MaxHealth); }