/// <summary> /// 设置对应数据与目标对象 /// </summary> /// <param name="a"></param> /// <param name="t"></param> public void setdata(MEnemyInfo a, GameObject t) { maincam = Camera.main; data = a; data.OnHpChange += hpchange; target = t; HpBar = this.gameObject.GetComponent <Image>(); gameObject.SetActive(true); }
public void sethpbar(GameObject a, EnemySpawn spawn) { spawner = spawn; hpbar = a; a.SetActive(true); //获得模型 if (data == null) { data = new MEnemyInfo(100); } else { data.revive(); } //绑定view model a.GetComponent <VenemyOnGUI>().setdata(data, gameObject); data.Die += Die; }