public void GotHit(int damage) { Health -= Math.Abs(damage); IsHurt = true; _healthBarController.Set(Health); _animator.SetBool("hurt", true); }
// Start is called before the first frame update void Start() { fallMultiplier = 1.2f; lowJumpFallMultiplier = 1.1f; playerSpeed = 150f; _renderer = GetComponentInParent <SpriteRenderer>(); _animator = GetComponentInParent <Animator>(); Health = 100; IsHurt = false; _healthBarController = HealthBar.GetComponent <SliderController>(); _healthBarController.Set(Health); }