29 lines
748 B
C#
29 lines
748 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class HeroInfoUI : MonoBehaviour
|
|
{
|
|
public GameObject target;
|
|
public BattleParticipant battleParticipant;
|
|
public Text nameText;
|
|
public Image healthBarBgImage;
|
|
public Image healthBarFgImage;
|
|
|
|
private Camera mainCamera;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
this.mainCamera = Camera.main;
|
|
this.nameText.text = this.battleParticipant.getDisplayName();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
Vector3 targetPos = this.mainCamera.WorldToScreenPoint(target.transform.position);
|
|
transform.position = targetPos;
|
|
}
|
|
}
|