添加韧性配置
This commit is contained in:
parent
2984aaa4be
commit
8b558f8a56
Binary file not shown.
Binary file not shown.
BIN
ProjectFish/Content/UI/WBP_PawnInfo.uasset
Normal file
BIN
ProjectFish/Content/UI/WBP_PawnInfo.uasset
Normal file
Binary file not shown.
@ -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
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user