public override void _Ready() { CharacterSprite = this.GetChildNode <Sprite>(nameof(CharacterSprite)); AnimationPlayer = this.GetChildNode <AnimationPlayer>(); CollisionShape2D = this.GetChildNode <CollisionShape2D>(nameof(CollisionShape2D)); State = this.GetChildNode <StateComponent>(); Stats = this.GetChildNode <Stats>(); CharacterHitBox = this.GetChildNode <CharacterHitBox>(); CharacterHitBox.Disable(); CharacterHurtBox = this.GetChildNode <CharacterHurtBox>(); BlinkAnimationPlayer = this.GetChildNodeOrNull <AnimationPlayer>(nameof(BlinkAnimationPlayer)); CharacterHurtBox.Connect(nameof(CharacterHurtBox.DamageReceived), this, nameof(ReceiveDamage)); HpIndicator = this.GetChildNode <HpIndicator>(); HpIndicator.Visible = true; Stats.Connect(nameof(Stats.HpWasChanged), HpIndicator, nameof(HpIndicator.OnChangeHp)); Stats.Connect(nameof(Stats.MaxHpWasChanged), HpIndicator, nameof(HpIndicator.OnChangeMaxHP)); HpIndicator.UpdateHealthIndication(); InvincibilityComponent = this.GetChildNode <InvincibilityComponent>(); InvincibilityComponent.Connect(nameof(InvincibilityComponent.InvincibilityStarted), this, nameof(StartInvincibility)); InvincibilityComponent.Connect(nameof(InvincibilityComponent.InvincibilityEnded), this, nameof(EndInvincibility)); }
public override void Die() { CharacterHurtBox.Disable(); CharacterHitBox.Disable(); CollisionShape2D.SetDeferred("disabled", true); AnimationPlayer.Play("Death"); }
public override void EndInvincibility() { CharacterHurtBox.Enable(); BlinkAnimationPlayer.ToEnd(); BlinkAnimationPlayer.Stop(); }
public override void StartInvincibility() { CharacterHurtBox.Disable(); BlinkAnimationPlayer.Play("Blink"); AnimationPlayer.Play("Hit"); }
public void EndRoll() { CharacterHurtBox.Enable(); }
public void StartRoll() { AnimationPlayer.Play("Roll"); CharacterHurtBox.Disable(); }