Beispiel #1
0
 public void GotHit(int damage)
 {
     Health -= Math.Abs(damage);
     IsHurt  = true;
     _healthBarController.Set(Health);
     _animator.SetBool("hurt", true);
 }
Beispiel #2
0
    // 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);
    }