Пример #1
0
    public void NewDamageText(Vector2 pos, int damage, bool critical)
    {
        Transform  d   = Instantiate(damageTextPrefab, this.transform) as Transform;
        DamageText txt = d.GetComponent <DamageText>();

        txt.SetDamage(pos, damage, critical);
    }
Пример #2
0
 public void AddDamageText(Vector2 pos, int damage, bool critical)
 {
     if (damagePoolCount <= 0)
     {
         NewDamageText(pos, damage, critical);
     }
     else
     {
         Transform d = damageTextPool[damagePoolCount - 1];
         damageTextPool[damagePoolCount - 1] = null;
         damagePoolCount--;
         DamageText txt = d.GetComponent <DamageText>();
         if (txt != null)
         {
             txt.SetDamage(pos, damage, critical);
         }
         else
         {
             Debug.LogError("BattleInfo.AddDamageText >> no DamageText component");
         }
     }
 }