H.Pなどの情報表示

hpというobjectをキャラの子供に配置しておく
3Dtextも子どもとして配置しておく

private void HPboard()
{
  GameObject childObject = gameObject.transform.FindChild("hp").gameObject;
  childObject.transform.localScale = new Vector3( (float)hp/hpMax, 0.1f, 0.01f);
  childObject = gameObject.transform.FindChild("exp").gameObject;

  string temp = "#" + no + " "+status+"\nhp"+hp+" exp" + exp;

  if (eval >= 3f)
    temp += " 脅威";
  childObject.GetComponent<TextMesh> ().text = temp;
}

タグ:

unity
最終更新:2015年05月26日 19:03