纳金网
标题:
IGUI的血条实例
[打印本页]
作者:
狂风大尉
时间:
2014-6-30 13:00
标题:
IGUI的血条实例
using UnityEngine;
using System.Collections;
using iGUI;
public class Test : MonoBehaviour
{
public Transform targetTransform;
public iGUIElement element;
float elementOffset = 0;
void Update()
{
Vector3 targetGUIPoint = Camera.main.WorldToScreenPoint(targetTransform.position + offset);
targetGUIPoint.y = Screen.height - targetGUIPoint.y;
targetGUIPoint.x -= element.rect.width * 0.5f;
targetGUIPoint.y -= element.rect.height * 0.5f;
element.rect.x = targetGUIPoint.x;
element.rect.y = targetGUIPoint.y;
//Unity3D教程:www.unitymanual.com
targetTransform.Translate(Input.GetAxis("Vertical") * Vector3.forward);
targetTransform.Translate(Input.GetAxis("Horizontal") * Vector3.left);
}
}
复制代码
作者:
wucnj
时间:
2014-6-30 14:09
感谢分享!!!
作者:
HIDEOKOJIMA
时间:
2014-6-30 14:38
感谢分享!
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5