Пример #1
0
    /// <summary>
    /// 更新按钮冷却时间
    /// </summary>
    private void Update()
    {
        if (!UpdateCoolDownAndCheck() || !isCharging)
        {
            return;
        }

        CurrentValue            += Time.deltaTime * chargeRate;
        sliderFullImg.fillAmount = GameMathf.Persents(minValue, maxValue, CurrentValue);
    }
Пример #2
0
 /// <summary>
 /// 获取目标的血条,计算扣血量并给给扣血。
 /// </summary>
 /// <param name="targetHealth">目标的血条</param>
 protected void TakeDamage(HealthManager targetHealth)
 {
     // 计算目标距离爆炸中心比例值(0 ~ 1,0为中),越靠近伤害越大,线性的
     targetHealth.SetHealthAmount(-1 * Mathf.Max(0f, GameMathf.Persents(explosionRadius, 0, (targetHealth.transform.position - transform.position).magnitude) * damage), launcher);
 }