Пример #1
0
 private void HealingAnimatedPeriodic()
 {
     if (isHealing)
     {
         float alpha = 1f / total * (total - GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>().getCurrentHealth());
         GameObject.FindGameObjectWithTag("Mask").GetComponent <Image>().color = new Color(1, 1, 1, alpha);
         bool fullyHealed = true;
         List <HeartLogic.Heart> heartList = HSystem.getHeartList();
         for (int i = 0; i < heartsImageList.Count; i++)
         {
             HeartImage       hImage = heartsImageList[i];
             HeartLogic.Heart heart  = heartList[i];
             if (hImage.GetFragmentsAmount() != heart.getFragmentAmount())
             {
                 hImage.AddHeartVisualFragment();
                 fullyHealed = false;
                 break;
             }
         }
         if (fullyHealed)
         {
             isHealing = false;
         }
     }
 }
Пример #2
0
    private void RefreshAllHearts()
    {
        List <HeartLogic.Heart> heartList = HSystem.getHeartList();

        for (int i = 0; i < heartsImageList.Count; i++)
        {
            HeartImage       hImage = heartsImageList[i];
            HeartLogic.Heart heart  = heartList[i];
            hImage.setHeartFragment(heart.getFragmentAmount());
        }
        float alpha = 1f / total * (total - GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>().getCurrentHealth());

        GameObject.FindGameObjectWithTag("Mask").GetComponent <Image>().color = new Color(1, 1, 1, alpha);
    }