Programming
ゲーム内で使うのに便利なコードを置いておく。
MakeHorizonalBar
横バー表示用文字列生成関数
ソース
public string MakeHorizonalBar(float value, int length){ int _top = Convert.ToInt32(value * length); if(_top > length){ _top = length; } string _result = ""; for(int i = 0; i < _top; i++){ _result += "l"; } for(int i = _top; i < length; i++){ _result += " "; } return _result; }
使用例
