Ejemplo n.º 1
0
 public void Revival() // 復活
 {
     Time.timeScale = 1;
     ani            = GetComponent <Animator>();
     ani.SetBool("死亡觸發", false);
     hp = data.hp;
     hpMpManager.UpdateHpBar(hp, hpMax);
     levelManager.CloseRevival();
 }
Ejemplo n.º 2
0
    /// <summary>
    /// 受傷
    /// </summary>
    /// <param name="damage">傷害</param>
    public void Hit(float damage)
    {
        int dmg = (int)damage;

        hp -= dmg;

        hpMpManager.UpdateHpBar(hp, data.hpMax);

        StartCoroutine(hpMpManager.ShowValue(dmg, "-", Vector3.one, Color.white));

        if (hp <= 0)
        {
            Dead();
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 受傷
    /// </summary>
    /// <param name="damage">傷害</param>
    public void Hit(float damage)
    {
        if (property == "fire" && Player.property == "water" |
            property == "water" && Player.property == "wood" |
            property == "wood" && Player.property == "fire" |
            property == "light" && Player.property == "dark" |
            property == "dark" && Player.property == "light"
            )
        {
            value = damage * 1.25f;
        }
        else if (property == "fire" && Player.property == "wood" |
                 property == "wood" && Player.property == "water" |
                 property == "water" && Player.property == "fire" |
                 property == "dark" && Player.property == "light" |
                 property == "light" && Player.property == "dark"
                 )
        {
            value = damage * 0.75f;
        }
        else
        {
            value = damage;
        }

        int dmg = (int)value;

        hp -= dmg;

        hpMpManager.UpdateHpBar(hp, data.hpMax);

        StartCoroutine(hpMpManager.ShowValue(dmg, "-", Vector3.one, Color.white));

        if (hp <= 0)
        {
            Dead();
        }
    }
Ejemplo n.º 4
0
 /// <summary>
 /// 每秒回復生命
 /// </summary>
 private void RestoreHp()
 {
     hp  = Mathf.Clamp(hp, 0, hpMax);
     hp += rehp * Time.deltaTime;
     hpMpManager.UpdateHpBar(hp, hpMax);
 }