public void TakeDamage(float damage) { stats.life -= damage; lifeBar.Set(stats.life, stats.maxLife); if (stats.life <= 0) { Die(); } }
void Start() { myPathThroughLife = route.path; transform.position = myPathThroughLife[index].transform.position; Recalculate(); health = maxHealth; barControl.Set(health, maxHealth); // Setup Bar Follow barControl.GetComponent <Follow>().target = transform; barControl.GetComponent <Follow>().barOffset = barOffset; }