Esempio n. 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());
    }
Esempio n. 2
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);
    }