public static void Create(Vector3 position, int damageAmount, bool isCriticalHit) { var combatManager = FindObjectOfType <CombatManager>(); GameObject damagePopupTransform = Instantiate(combatManager.DamagePopupPrefab, new Vector3(position.x, position.y + .7f), Quaternion.identity); DamagePopup damagePopup = damagePopupTransform.GetComponent <DamagePopup>(); damagePopup.Setup(damageAmount, isCriticalHit); }
public void ShowDamagePopup() { DamagePopup.Create(transform.position, damage, criticalHit); }