public void ApplyDamage(int amount) { currentHealth -= amount; hpBar.SetValue(currentHealth); source.PlayOneShot(hitSound, vol); Debug.Log(gameObject.transform.name + " received " + amount + " damage!"); CheckIfDead(); }
void Update() { if (isDead == true) { return; } if (hpBar != null) { hpBar.SetValue((float)hp / (float)startHp); } }
// 기본적인 처리( 이동 등등 ) protected virtual void Update() { if (isDead == true || stageCtrler.IsStageEnd == true) { return; } if (hpBar != null) { hpBar.SetValue((float)hp / (float)startHp); } if (isMoving == true) { transform.Translate(Vector3.right * Time.deltaTime * moveSpeed); } }
private void SetHpBar() { HpBar.SetValue((float)(Hp / PlayerData.Hp)); SetTexts(); }