Example #1
0
    public override string GetText()
    {
        float     xp          = 0;
        XPHandler xpComponent = player.GetComponent <XPHandler>();

        if (xpComponent != null)
        {
            xp = xpComponent.GetXp();
            xp = Mathf.Floor(xp);
        }
        return(xp.ToString());
    }
 public void DoDamage(Component enemy)
 {
     if (Utility.HealthUtility.DeductHealth(enemy, damage))
     {
         Destroy(enemy.gameObject);
         XPHandler xpComponent = this.GetComponent <XPHandler>();
         if (xpComponent != null)
         {
             xpComponent.AddXp(10);
         }
         Debug.Log("Destroyed2");
     }
 }
Example #3
0
    public override float GetWidth()
    {
        float     baseWidth   = Screen.width - (Screen.width / 3);
        float     newWidth    = this.width;
        float     xp          = 0;
        XPHandler xpComponent = player.GetComponent <XPHandler>();

        if (xpComponent != null)
        {
            xp = xpComponent.GetXp();
        }

        if (xp > 0)
        {
            newWidth = baseWidth * xp / 1000;
        }
        else
        {
            newWidth = 0;
        }

        return(newWidth);
    }