以前没接触这个插件时,做的小demo中实现怪物血条使用GUI绘制的 (就是雨松大大的方法,很经典 在这里先谢过大大) 用这个插件实现怪物血条只需简单的几部 方法直接封装好的 直接用就好 该插件必须是在安装NGUI之后才能用 这插件的核心就是HUDText 和 UIFollowTarget这两个脚本(个人观点)以下是我做的一个小小的demo来模拟一下该功能
首先在UIRoot下建立一个空物体改名字为Hud 上面挂载HUDText 和 UIFollowTarget这两个脚本 下面是 UIFollowTarget和HUDText脚本上的一些参数了
在UIRoot下创建一个简易的血条Blood(sprite) 添加Blood的子物体 Filled (sprite) 这里的精灵类型选择为Filled 然后只需要改变fillAmount的大小就可以实现血量的增大减小 Blood上需要挂载挂载UIFollowTarget