初学GAS,仅用作自己查缺补漏,不想再做时又去找视频
参考教程:
英文原版(联机):Ambience Lee:
https://www.udemy.com/course/introduction-to-unreal-engine-4-ability-system/
中文翻译重置(单机):小明:
https://space.bilibili.com/149146076/channel/detail?cid=127939&ctype=0
一、创建属性集合并放进Character中
1.1、c++逻辑
AttributeSetBase.h
#pragma once
#include "CoreMinimal.h"
#include "AttributeSet.h"
#include "AttributeSetBase.generated.h"
/**
*
*/
UCLASS()
class GASTEST_API UAttributeSetBase : public UAttributeSet
{
GENERATED_BODY()
public:
UAttributeSetBase();
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FGameplayAttributeData Health;
};
AttributeSetBase.cpp
UAttributeSetBase::UAttributeSetBase()
:Health(100.f)
{
}
MyGASCharacter
UPROPERTY(VisibleAnywhere,BlueprintReadOnly)
class UAttributeSetBase* AttributeSet;
AttributeSet = CreateDefaultSubobject<UAttributeSetBase>(TEXT("AttributeSet"));
1.2、蓝图测试一下
二、给角色添加攻击通讯
2.1、创建一把附着在剑上的碰撞,并设置碰撞仅针对Pawn
2.2、复制角色蓝图,创建一个敌人蓝图
一切不变,删除不必要的摄像机和蓝图