Ejemplo n.º 1
0
    public void SetBloodBossAmount(float bloodAmount, XKNpcHealthCtrl bossHealth = null)
    {
        if (bossHealth != null && bloodAmount == -1f)
        {
            BossHealthScript = bossHealth;             //存储Boss血量脚本.
        }

        if (!IsCanSubXueTiaoAmount)
        {
            return;
        }

        if (!gameObject.activeSelf)
        {
            return;
        }

        bloodAmount = bloodAmount > 1f ? 1f : bloodAmount;
        bloodAmount = bloodAmount < 0f ? 0f : bloodAmount;
        BossXueTiaoSprite.fillAmount = bloodAmount;
        if (bloodAmount <= 0f)
        {
            //JiFenJieMianCtrl.GetInstance().ShowFinishTaskInfo();
            IsWuDiPlayer = true;
            Invoke("DelayActiveJiFenJieMian", 4f);
            XkGameCtrl.BossRemoveAllNpcAmmo();
            AudioBeiJingCtrl.StopGameBeiJingAudio();
            HiddenBossXueTiao();
            if (BossHealthScript != null && bossHealth == null)
            {
                BossHealthScript.OnDamageNpc(99999999, PlayerEnum.Null);
            }
        }
    }
    public void SetBloodBossAmount(float bloodAmount)
    {
        //bloodAmount [0, 1]
        //realAmount [0, m_MaxFillAmount]
        float key = m_MaxFillAmount;
        //(realBloodAmount - 0) / (bloodAmount - 0) = key;
        //realBloodAmount = bloodAmount * key;
        float realBloodAmount = bloodAmount * key;

        bloodAmount = realBloodAmount;

        if (!IsCanSubXueTiaoAmount)
        {
            return;
        }

        if (!gameObject.activeSelf)
        {
            return;
        }

        bloodAmount = Mathf.Clamp(bloodAmount, 0f, 1f);
        BossXueTiaoSprite.fillAmount = bloodAmount;
        if (bloodAmount <= 0f)
        {
            XkGameCtrl.BossRemoveAllNpcAmmo();
            HiddenBossXueTiao();
        }
    }