// Update is called once per frame
    void Update()
    {
        if (gm.state == 0 && gm.EnemiesTotal != 0)
        {
            hb.current = gm.EnemiesLeftToSpawn + gm.EnemiesLeftAlive;
            //Alternative to just keep track of spawning
            //hb.current=gm.EnemiesTotal-gm.EnemiesLeftToSpawn;
            hb.max = gm.EnemiesTotal;
        }
        else
        {
            hb.current = 1;
            hb.max     = 1;
        }



        hb.UpdateHealthBar();
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     hb.current = healthStats.health;
     hb.max     = healthStats.maxHealth;
     hb.UpdateHealthBar();
 }