Exemple #1
0
    /// <summary>
    /// Creates the HP Bar Object
    /// </summary>
    /// <param name="targetCreature"></param>
    /// <param name="hpPercent"></param>
    /// <param name="hpBarColor"></param>
    public HPBar(GameObject targetCreature, float hpPercent, Color hpBarColor, object hpBarBackgroundColor = null)
    {
        this.targetCreature = targetCreature;
        this.hpPercent      = hpPercent;
        this.hpBarColor     = DrawHandler.getColor(hpBarColor);
        //Look at this dumb shit.
        if (hpBarBackgroundColor == null)
        {
            this.hpBarBackgroundColor = DrawHandler.getColor(Color.black);
        }
        else
        {
            this.hpBarBackgroundColor = DrawHandler.getColor((Color)hpBarBackgroundColor);
        }

        DrawHandler.itemsToDraw.Add(this);
    }
Exemple #2
0
 /// <summary>
 /// Updates the current hp percent and color.
 /// </summary>
 /// <param name="newHPPercent"></param>
 /// <param name="hpBarColor"></param>
 public void updateCreatureHP(float newHPPercent, Color hpBarColor)
 {
     hpPercent       = newHPPercent;
     this.hpBarColor = DrawHandler.getColor(hpBarColor);
 }