NGUI之使用UISprite画线

代码如下:

 1         static void DrawLine(UISprite spriteLine, Vector3 start, Vector3 end)
 2         {
 3             Vector3 center = (start + end) / 2f;
 4             Vector3 fromStart = end - start;
 5             Vector3 horVector = Vector3.right;
 6             Quaternion rot = Quaternion.FromToRotation(horVector, fromStart);
 7 
 8             spriteLine.transform.localPosition = center;
 9             spriteLine.transform.localRotation = rot;
10             spriteLine.width = Mathf.CeilToInt(fromStart.magnitude);
11         }

 转载请注明出处:https://www.cnblogs.com/jietian331/p/10653398.html

posted @ 2019-04-04 10:22  孤独の巡礼  阅读(823)  评论(0编辑  收藏  举报