48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
// Copyright Majowaveon Games. All Rights Reserved.
|
||
|
||
#pragma once
|
||
|
||
#include "CoreMinimal.h"
|
||
#include "DamageableInterface.h"
|
||
#include "GameFramework/Pawn.h"
|
||
#include "EnemyBase.generated.h"
|
||
|
||
class UHealthComponent;
|
||
|
||
/**
|
||
* @class AEnemyBase
|
||
* @brief 敌人基类,实现了可受伤害接口。
|
||
* @ingroup Battle
|
||
*/
|
||
UCLASS()
|
||
class FIRSTPERSONDEMO_API AEnemyBase : public APawn, public IDamageableInterface {
|
||
GENERATED_BODY()
|
||
|
||
public:
|
||
/**
|
||
* @brief 构造函数,设置Pawn的默认属性。
|
||
*/
|
||
AEnemyBase();
|
||
|
||
protected:
|
||
/**
|
||
* @brief 管理敌人生命值的组件。
|
||
*/
|
||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
|
||
UHealthComponent* HealthComponent;
|
||
|
||
virtual void BeginPlay() override;
|
||
|
||
public:
|
||
virtual void Tick(float DeltaTime) override;
|
||
|
||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||
|
||
/**
|
||
* @brief 接收伤害的接口实现。
|
||
* @param DamageAmount 伤害量。
|
||
* @param InstigatorActor 造成伤害的Actor。
|
||
*/
|
||
virtual void ReceiveDamage(float DamageAmount, AActor* InstigatorActor) override;
|
||
};
|