public void SetHP(int hp) { //Set in Operator Data HP _operatorData.SetCurHP(hp); //Set in HPbar of Operator HP operatorHpComponent.SetHP(hp); //Update Info of selecting Operator(Only HP Field) if (MainController.mainInterfaceFields.selectOperatorUI.displaySelectedPanel.activeSelf && MainController.mainInterfaceFields.selectOperatorUI.operatorController == this) { MainController.mainInterfaceFields.selectOperatorUI.UpdateSelectInfoOnlyHP(); } }
private IEnumerator HealthChange() { while (!isDead) { if (HPdamage > 0 && HP > 0) { int curHP = uiOperatorHp.GetHPValue(); float newPosition = Mathf.SmoothDamp(curHP, HP, ref velocityHP, 0.3f); uiOperatorHp.SetHP((int)newPosition); HPdamage -= (curHP - newPosition); } yield return(new WaitForSeconds(0.03f)); } yield return(null); }