添加韧性配置

This commit is contained in:
997146918 2025-07-15 16:52:32 +08:00
parent 2984aaa4be
commit 8b558f8a56
6 changed files with 23 additions and 3 deletions

Binary file not shown.

View File

@ -16,11 +16,17 @@ void APawnWithSkill::ApplyyEndurance_Implementation(float enduranceOffset)
CurrentEndurance += enduranceOffset;;
}
void APawnWithSkill::ApplyyTenacity_Implementation(float tenacityOffset)
{
CurrentTenacity += tenacityOffset;
}
// Called when the game starts or when spawned
void APawnWithSkill::BeginPlay()
{
Super::BeginPlay();
CurrentEndurance = MaxEndurance;
CurrentTenacity = MaxTenacity;
}
// Called every frame

View File

@ -16,6 +16,8 @@ public:
APawnWithSkill();
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void ApplyyEndurance(float enduranceOffset);
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
void ApplyyTenacity(float tenacityOffset);
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
@ -32,4 +34,14 @@ public:
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category= Default, meta = (DisplayPriority = 0, ToolTip = "最大耐久度"))
float MaxEndurance;
UPROPERTY(BlueprintReadWrite, meta = (ToolTip = "当前韧性"))
float CurrentTenacity;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category= Default, meta = (DisplayPriority = 0, ToolTip = "最大韧性"))
float MaxTenacity;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category= Default, meta = (DisplayPriority = 0, ToolTip = "韧性归零时眩晕时长"))
float TenacityStun_Time = 5;
};

View File

@ -52,13 +52,15 @@ void USkill::InitSkill(APawnWithSkill* owner, USkillManager* skillManager, FSkil
bool USkill::SkillTickAble()
{
return RemainingEndurance >0 || RemainingEndurance == -1;
//剩余次数无限制或者拥有者没有被韧性眩晕
return (RemainingEndurance >0 || RemainingEndurance == -1) && Owner->CurrentTenacity > 0;
}
void USkill::TickSkill(float deltaTime)
{
if (SkillTickAble())
RemainingTime -= deltaTime * SkillData.Speed;
if (RemainingTime <= 0 && SkillTickAble())
if (RemainingTime <= 0 )
{
RemainingTime = 0;
if (RemainingEndurance >0)