当前位置:   article > 正文

unity3d简单血条的制作方法_unity gui.drawtexture 画血条

unity gui.drawtexture 画血条

通过gui的GUI.DrawTexture方法来实现血条,如下图:

 

  1. using UnityEngine;
  2. using System.Collections;
  3. /// <summary>
  4. /// 血条
  5. /// 小伍 QQ:16349023
  6. /// </summary>
  7. public class Wy2HealthBar : MonoBehaviour {
  8. public Texture2D HealthBg;
  9. public Texture2D Heathforce;
  10. public Vector2 offset = new Vector2(13,15);
  11. private Wy2AIHealth health;
  12. void Setup()
  13. {
  14. health = GetComponent<Wy2AIHealth>();
  15. }
  16. void Reset()
  17. {
  18. Setup();
  19. }
  20. // Use this for initialization
  21. void Start () {
  22. Setup();
  23. }
  24. // Update is called once per frame
  25. void Update () {
  26. }
  27. void OnGUI()
  28. {
  29. if (Event.current.type != E
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/122494
推荐阅读
相关标签
  

闽ICP备14008679号