/// <summary> /// 提供一个分数参数,将其画下来 /// </summary> /// <param name="isc">Score参数</param> /// <param name="distance">数字间的距离</param> public void DrawNumber(Renderer _renderer, IScore isc, float distance) { float alpha = isc.alpha; Vector2D vct = new Vector2D(isc.Position.X, isc.Position.Y); string num = isc.Score.ToString(); char[] arr = num.ToArray <char>(); int length = arr.Length; int len2 = length / 2; for (int i = 0; i < length; i++) { Sprite sp = score_number.GetNumber(arr[i].ToString()); sp.SetPosition(vct.X + (i - len2) * distance, vct.Y); //数字居中显示 sp.SetColor(new Color(1, 1, 1, alpha * 0.5f)); _renderer.DrawSprite(sp); } }
/// <summary> /// 提供一个分数参数,将其画下来 /// </summary> /// <param name="isc">Score参数</param> /// <param name="distance">数字间的距离</param> public void DrawNumber(Renderer _renderer, IScore isc , float distance) { float alpha = isc.alpha; Vector2D vct = new Vector2D(isc.Position.X, isc.Position.Y); string num = isc.Score.ToString(); char[] arr = num.ToArray<char>(); int length = arr.Length; int len2 = length / 2; for (int i = 0; i < length; i++) { Sprite sp = score_number.GetNumber(arr[i].ToString()); sp.SetPosition(vct.X + (i-len2) * distance, vct.Y); //数字居中显示 sp.SetColor(new Color(1, 1, 1, alpha*0.5f)); _renderer.DrawSprite(sp); } }