StatusBar.AddBar C# (CSharp) Method

AddBar() public method

public AddBar ( Texture2D tex, int index, Vector2 pos ) : Texture2D
tex UnityEngine.Texture2D
index int
pos Vector2
return UnityEngine.Texture2D
    public Texture2D AddBar(Texture2D tex, int index, Vector2 pos)
    {
        if(index < this.currentCharacter.Length && this.currentCharacter[index] != null)
        {
            float v1 = 0;
            float v2 = 0;
            if(this.statusID < 0)
            {
                v1 = this.currentCharacter[index].timeBar;
                v2 = DataHolder.BattleSystem().actionBorder;
            }
            else if(this.currentCharacter[index].status[this.statusID].IsConsumable())
            {
                v1 = this.currentCharacter[index].status[this.statusID].GetValue();
                v2 = this.currentCharacter[index].status[this.currentCharacter[index].status[this.statusID].maxStatus].GetValue();
            }
            else if(this.currentCharacter[index].status[this.statusID].IsNormal())
            {
                v1 = this.currentCharacter[index].status[this.statusID].GetValue();
                v2 = this.currentCharacter[index].status[this.statusID].maxValue;
            }
            else if(this.currentCharacter[index].status[this.statusID].IsExperience())
            {
                int current = this.currentCharacter[index].GetValueAtLevel(this.statusID, this.currentCharacter[index].currentLevel);
                v1 = this.currentCharacter[index].status[this.statusID].GetValue()-current;
                v2 = this.currentCharacter[index].GetValueAtLevel(this.statusID, this.currentCharacter[index].currentLevel+1)-current;
            }
            v2 /= 100;
            v1 /= v2;

            this.GetImage();
            if(this.showEmpty) this.GetEmptyImage();
            Rect b = new Rect(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height);
            if(this.emptyTexture != null)
            {
                Vector2 scaledSize = TextureDrawer.GetScaledSize(this.texture, b, this.scaleMode);
                tex = TextureDrawer.AddTexture(tex,
                        new Rect(b.x+pos.x, tex.height-b.y-scaledSize.y, scaledSize.x, scaledSize.y),
                        TextureDrawer.GetScaledPixels(this.emptyTexture, scaledSize, b, this.scaleMode));
            }
            if(this.texture != null)
            {
                b.width *= v1/100;
                Vector2 scaledSize = TextureDrawer.GetScaledSize(this.texture, b, this.scaleMode);
                tex = TextureDrawer.AddTexture(tex,
                        new Rect(b.x+pos.x, tex.height-b.y-scaledSize.y, scaledSize.x, scaledSize.y),
                        TextureDrawer.GetScaledPixels(this.texture, scaledSize, b, this.scaleMode));
            }
        }
        return tex;
    }