コード例 #1
0
    public void CreateHealthBar(HealthComponent health)
    {
        UI_HealthBar healthBar = Instantiate(Prefab, transform);

        healthBar.gameObject.name = string.Format("Health Bar ({0})", health.gameObject.name);
        healthBar.HealthObj       = health;

        UI_Follow follow = healthBar.GetComponent <UI_Follow>();

        follow.Target = health.transform;
    }
コード例 #2
0
 private void Awake()
 {
     uiHealthBar = FindObjectOfType <UI_HealthBar>().GetComponent <UI_HealthBar>();
 }