Esempio n. 1
0
    public void SetHeartsHealthSystem(HeartLogic h)
    {
        this.HSystem  = h;
        HSystemStatic = h;

        List <HeartLogic.Heart> heartList = HSystem.getHeartList();
        int   row = 0, col = 0;
        int   colMax = 5;
        float rowColsize = 65f;

        foreach (HeartLogic.Heart heart in heartList)
        {
            Vector2 heartAnchoredPosition = new Vector2(col * rowColsize, -row * rowColsize);
            CreateHeartImage(heartAnchoredPosition).setHeartFragment(heart.getFragmentAmount());

            col++;
            if (col >= colMax)
            {
                row++;
                col = 0;
            }
        }

        HSystem.OnDamaged += HeartLogic_OnDamaded;
        HSystem.OnHealed  += HeartLogic_OnHealed;
        HSystem.OnDead    += HeartLogic_OnDead;
    }
Esempio n. 2
0
 private void Start()
 {
     FunctionPeriodic.Create(HealingAnimatedPeriodic, .05f);
     if (GameManager.instance)
     {
         total = GameManager.instance.saveData.playerData.vitality;
         HeartLogic HSystem = new HeartLogic(total / 4);
         HSystem.Damage(total - (GameManager.instance.saveData.playerData.currentVitality));
         SetHeartsHealthSystem(HSystem);
     }
     else
     {
         total = 20;
         HeartLogic HSystem = new HeartLogic(5);
         SetHeartsHealthSystem(HSystem);
     }
 }