コード例 #1
0
 public void _on_Hurtbox_area_entered(SwordHitbox area)
 {
     knockback = area.knockbackVector * 150;
     stats.changeHealth(-area.damage);
     blinkAnimationPlayer.Play("StartBlink");
     hurtbox.startInvincibility(0.4f);
     hurtbox.createHitEffect();
     healthBar.setHealth(stats.getCurrentHealth());
 }
コード例 #2
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        playerStats = (Stats)GetNode("/root/PlayerStats");
        playerStats.Connect("noHitpoints", this, "_onNoHitPoints");

        rollCdTimer          = ROLL_COOLDOWN;
        swordHitbox          = GetNode <SwordHitbox>("HitboxPivot/SwordHitbox");
        hurtbox              = GetNode <Hurtbox>("Hurtbox");
        animationPlayer      = GetNode <AnimationPlayer>("AnimationPlayer");
        blinkAnimationPlayer = GetNode <AnimationPlayer>("BlinkAnimationPlayer");
        animationTree        = GetNode <AnimationTree>("AnimationTree");
        animationTree.Active = true;
        animationState       = animationTree.Get("parameters/playback") as AnimationNodeStateMachinePlayback;
    }