private void HealingAnimatedPeriodic()
 {
     if (isHealing)
     {
         bool fullyHealed = true;
         List <HeartsHealthSystem.Heart> heartList = heartsHealthSystem.GetHeartList();
         for (int i = 0; i < heartList.Count; i++)
         {
             HeartImage heartImage          = heartImageList[i];
             HeartsHealthSystem.Heart heart = heartList[i];
             if (heartImage.GetFragmentAmount() != heart.GetFragmentAmount())
             {
                 // Visual is different from logic
                 heartImage.AddHeartVisualFragment();
                 if (heartImage.GetFragmentAmount() == HeartsHealthSystem.MAX_FRAGMENT_AMOUNT)
                 {
                     // This heart was fully healed
                     heartImage.PlayHeartFullAnimation();
                 }
                 fullyHealed = false;
                 break;
             }
         }
         if (fullyHealed)
         {
             isHealing = false;
         }
     }
 }
Exemplo n.º 2
0
    private void HealingAnimatedPeriodic()
    {
        if (!isHealing)
        {
            return;
        }
        bool fullyHealed = true;

        for (int i = 0; i < heartImageList.Count; i++)
        {
            HeartImage heartImage          = heartImageList[i];
            HeartsHealthSystem.Heart heart = heartsHealthSystem.GetHeartList()[i];
            if (Math.Round(heartImage.GetValue(), 3) != heart.GetValue())
            {
                heartImage.AddHeartVisualValue();
                if (Math.Round(heartImage.GetValue(), 2) == HeartsHealthSystem.MAX_HEARTH_VALUE)
                {
                    heartImage.PlayHeartFullAnimation();
                }
                fullyHealed = false;
                break;
            }
        }
        if (fullyHealed)
        {
            isHealing = false;
        }
    }
Exemplo n.º 3
0
    public void HealingAnimatedPeriodic()
    {
        if (isHealing)
        {
            bool fullyHealed = true;

            List <HealthHeartsSystem.Heart> heartList = healthHeartsSystem.GetHeartList();
            for (int i = 0; i < heartList.Count; i++)
            {
                HeartImage heartImage          = heartImageList[i];
                HealthHeartsSystem.Heart heart = heartList[i];

                if (heartImage.GetFragmentAmount() != heart.GetFragmentAmount())
                {
                    //Comprobar si el resultado visual es diferente de la lógica
                    heartImage.AddHeartVisualFragment();
                    if (heartImage.GetFragmentAmount() == HealthHeartsSystem.MAX_FRAGMENT_AMOUNT)
                    {
                        //Este corazón estaba completamente curado
                        heartImage.PlayHeartFullAnimation();
                    }
                    fullyHealed = false;
                    break;
                }
            }

            if (fullyHealed)
            {
                isHealing = false;
            }
        }
    }