58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "SkillEffect.h"
|
|
|
|
//#include "AsyncTreeDifferences.h"
|
|
#include "Skill.h"
|
|
|
|
|
|
|
|
void USkillEffect::InitSkillEffect(class USkill* skill, FSkillEffectData data)
|
|
{
|
|
this->OwnerSkill = skill;
|
|
this->effectData = data;
|
|
}
|
|
|
|
// Add default functionality here for any ISkillEffect functions that are not pure virtual.
|
|
void USkillEffect::Execute(const FSkillContext& context)
|
|
{
|
|
TArray<UObject*> targets= context.SkillManager->GetTargetsBySelector(context.OwnerSkill, effectData.SkillSelecter);
|
|
FString strTargets;
|
|
for (auto target: targets)
|
|
{
|
|
if (target->GetClass()->IsChildOf(APawnWithSkill::StaticClass()))
|
|
{
|
|
strTargets += (Cast<APawnWithSkill>(target))->GetActorNameOrLabel() +"|" ;
|
|
}
|
|
else
|
|
{
|
|
strTargets += (Cast<USkill>(target))->GetSkillData()->SkillName.ToString() + "|" ;
|
|
}
|
|
|
|
}
|
|
const UEnum* EnumPtr = StaticEnum<ESkillEffectType>();
|
|
FString type = EnumPtr->GetNameStringByValue(static_cast<int64>(effectData.EffectType)) ;
|
|
|
|
UE_LOG(LogTemp, Warning, TEXT("技能:%s 拥有者: %s 目标: %s 效果: %s")
|
|
, *OwnerSkill->GetSkillData()->SkillName.ToString()
|
|
,*OwnerSkill->GetOwner()->GetActorNameOrLabel()
|
|
,*strTargets
|
|
, *( GetSkillEffectDes()));
|
|
}
|
|
|
|
void USkillEffect::Cancel(const FSkillContext& context)
|
|
{
|
|
}
|
|
|
|
// void USkillEffect::EffectEnded(const FSkillContext& context)
|
|
// {
|
|
// }
|
|
|
|
|
|
FString USkillEffect::GetSkillEffectDes()
|
|
{
|
|
return FString();
|
|
}
|
|
|