NGUI HUD text 代码示例
来源:互联网 发布:淘宝性价比高包包店铺 编辑:程序博客网 时间:2024/05/18 02:35
//测试代码:using UnityEngine;using System.Collections;[AddComponentMenu("GameName/UseHUDExample")]public class UseHUD : MonoBehaviour{ public Transform m_target;//HUD字体出现的位置 public GameObject m_hudTextPrefab;//HUD字体 prefab,不可为空 HUDText m_hudText = null;//HUD字体 // 初始化时调用 void Start () { if (HUDRoot.go == null) { GameObject.Destroy (this); return; } if (m_target == null) { m_target=this.transform; Vector3 mpos = this.transform.position; mpos.y += 2; m_target.position = mpos; } //添加hud text到HUDRoot结点下 GameObject child = NGUITools.AddChild (HUDRoot.go, m_hudTextPrefab); //获取HUDText m_hudText = child.GetComponent<HUDText> (); //添加UIFollow脚本 child.AddComponent<UIFollowTarget> ().target = m_target; } // 每帧调用此函数一次 void Update () { if (Input.GetMouseButton (0)) { m_hudText.Add ("+100", Color.red, 0); } if (Input.GetMouseButton (1)) { m_hudText.Add ("-30", Color.green, 0); } if (Input.GetMouseButton (2)) { m_hudText.Add ("漂亮!", Color.cyan, 0); } } void OnClick () { if (m_hudText != null) { m_hudText.Add ("HUD TEXT", Color.red, 1.0f); } }}
阅读全文
1 0
- NGUI HUD text 代码示例
- NGUI:HUD Text
- NGUI中的HUD Text插件使用教程
- 有关NGUI HUD Text 的使用
- 有关NGUI HUD Text 的使用
- Unity NGUI HUD text简单使用
- Unity的NGUI插件的HUD Text插件血条数值的显示
- 自制NGUI HUD血条
- javascript读写TEXT文本文件示例代码
- select控件获取text值示例代码
- NGUI示例-UIAnchor讲解
- NGUI示例-Interaction讲解
- NGUI示例-Menu讲解
- NGUI示例-ControlIerInput讲解
- unity ngui 示例
- TX Text Control拖拽文件的示例代码
- text控件监听键盘弹出和关闭示例代码
- [LeetCode]68. Text Justification 深入浅出讲解和代码示例
- 阿里的数仓
- Android强制下线功能
- 2017知乎看山杯总结(多标签文本分类)
- JdbcTemplate学习杂记
- IDEA快捷键
- NGUI HUD text 代码示例
- 实用类(和电脑玩猜拳游戏)
- linux目录结构
- Gym 101158C Distribution Center(思路题)
- 分布式环境下限流方案的实现redis RateLimiter Guava,Token Bucket, Leaky Bucket
- 深入理解Java多态机制
- Android内存优化
- MySQL InnoDB存储结构
- 凸包(判多边形的凹凸性)