public void Init(XKNpcHealthCtrl npcHealth) { if (npcHealth != null) { float xueLiang = npcHealth.GetHealthValue(); mNpcHealth = npcHealth; ShowZuDangXuTiaoVal(xueLiang); } }
void Update() { if (mNpcHealth != null && Time.frameCount % 2 == 0) { float xueLiang = mNpcHealth.GetHealthValue(); if (xueLiang != mXuTiaoSprite.fillAmount) { ShowZuDangXuTiaoVal(xueLiang); } } }