添加鱼竿增强技能效果
This commit is contained in:
parent
7b57eaa7ac
commit
59c715af32
Binary file not shown.
@ -18,6 +18,11 @@ UFishingRodComponent::UFishingRodComponent()
|
||||
// ...
|
||||
}
|
||||
|
||||
void UFishingRodComponent::AddFishRodDamage(int32 Damage)
|
||||
{
|
||||
FishRodData.Damage += Damage;
|
||||
}
|
||||
|
||||
|
||||
// Called when the game starts
|
||||
void UFishingRodComponent::BeginPlay()
|
||||
|
@ -17,7 +17,7 @@ class PROJECTFISH_API UFishingRodComponent : public UActorComponent
|
||||
public:
|
||||
// Sets default values for this component's properties
|
||||
UFishingRodComponent();
|
||||
|
||||
void AddFishRodDamage(int32 Damage);
|
||||
protected:
|
||||
// Called when the game starts
|
||||
virtual void BeginPlay() override;
|
||||
|
@ -17,6 +17,7 @@ enum class ESkillEffectType: uint8
|
||||
Charge UMETA(DisplayName = "充能", ToolTip = "使技能的冷却进度加快"),
|
||||
ModifySpeed UMETA(DisplayName = "速度修改", ToolTip = "使技能冷却进度倍率进展 持续指定时间"),
|
||||
SkillEnduranceRestore UMETA(DisplayName = "技能耐久度恢复", ToolTip = "使技能耐久度恢复"),
|
||||
EnHanceFishRod UMETA(DisplayName = "增强鱼竿", ToolTip = "使鱼竿上海增加"),
|
||||
};
|
||||
|
||||
//技能对象类型
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "SkillTrigger.h"
|
||||
#include "SkillEffects/SkillEffect_Charge.h"
|
||||
#include "SkillEffects/SkillEffect_Damage.h"
|
||||
#include "SkillEffects/SkillEffect_EnhanceFishRod.h"
|
||||
#include "SkillEffects/SkillEffect_Heal.h"
|
||||
#include "SkillEffects/SkillEffect_ModifyCD.h"
|
||||
#include "SkillEffects/SkillEffect_ModifySpeed.h"
|
||||
@ -42,6 +43,12 @@ void USkill::InitSkill(APawnWithSkill* owner, USkillManager* skillManager, FSkil
|
||||
case ESkillEffectType::SkillEnduranceRestore:
|
||||
skillEffect = NewObject<USkillEffect>(this, USkillEffect_SER::StaticClass());
|
||||
break;
|
||||
case ESkillEffectType::EnHanceFishRod:
|
||||
skillEffect = NewObject<USkillEffect>(this, USkillEffect_EnhanceFishRod::StaticClass());
|
||||
break;
|
||||
default:
|
||||
const UEnum* EnumPtr = StaticEnum<ESkillEffectType>();
|
||||
UE_LOG(LogTemp, Error, TEXT("没有配置 %s类型的Skill Effect"), *EnumPtr->GetNameStringByValue(static_cast<int64>(effectData.EffectType)))
|
||||
}
|
||||
if (IsValid(skillEffect))
|
||||
{
|
||||
@ -56,12 +63,21 @@ void USkill::InitSkillTrigger()
|
||||
{
|
||||
if (!SkillData.bActiveSkill)
|
||||
{
|
||||
|
||||
USkillTrigger* SkillTrigger = NewObject<USkillTrigger>(this, SkillData.SkillTrigger);
|
||||
if (SkillTrigger)
|
||||
{
|
||||
FSkillContext context;
|
||||
context.OwnerSkill = this;
|
||||
context.SkillManager = SkillManager;
|
||||
SkillTrigger->Init(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("没有Trigger的被动技能,直接触发"));
|
||||
ExecuteSkill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "SkillEffect_EnhanceFishRod.h"
|
||||
|
||||
#include "ProjectFish/Components/FishingRodComponent.h"
|
||||
#include "ProjectFish/Skill/Skill.h"
|
||||
|
||||
void USkillEffect_EnhanceFishRod::Execute(const FSkillContext& context)
|
||||
{
|
||||
Super::Execute(context);
|
||||
APawnWithSkill* OwnerPawn = context.OwnerSkill->GetOwner();
|
||||
if (OwnerPawn->GetComponentByClass(UFishingRodComponent::StaticClass()) != NULL)
|
||||
{
|
||||
UFishingRodComponent* rod = Cast<UFishingRodComponent>(OwnerPawn->GetComponentByClass(UFishingRodComponent::StaticClass()));
|
||||
rod->AddFishRodDamage( (int32)(effectData.EffectValue));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FString USkillEffect_EnhanceFishRod::GetSkillEffectDes()
|
||||
{
|
||||
return FString::Printf(TEXT("使鱼竿的伤害增加 %d点"), (int32)(effectData.EffectValue));
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ProjectFish/Skill/SkillEffect.h"
|
||||
#include "SkillEffect_EnhanceFishRod.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROJECTFISH_API USkillEffect_EnhanceFishRod : public USkillEffect
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
void Execute(const FSkillContext& context) override;
|
||||
FString GetSkillEffectDes() override;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user