示例#1
0
文件: Npc.cs 项目: Mauvemau/LeapLash
 public void ApplyDamage(int amount)
 {
     currentHealth -= amount;
     hpBar.SetValue(currentHealth);
     source.PlayOneShot(hitSound, vol);
     Debug.Log(gameObject.transform.name + " received " + amount + " damage!");
     CheckIfDead();
 }
示例#2
0
    void Update()
    {
        if (isDead == true)
        {
            return;
        }

        if (hpBar != null)
        {
            hpBar.SetValue((float)hp / (float)startHp);
        }
    }
示例#3
0
    // 기본적인 처리( 이동 등등 )
    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);
        }
    }
示例#4
0
 private void SetHpBar()
 {
     HpBar.SetValue((float)(Hp / PlayerData.Hp));
     SetTexts();
 }