Add PaperFlipbookComponent to VampireCharacter class

This commit is contained in:
baz 2024-08-23 02:14:07 +01:00
parent d6f728e376
commit c9c1753233
3 changed files with 13 additions and 4 deletions

View File

@ -38,6 +38,7 @@ void AVampireAIController::OnPossess(APawn* InPawn)
EnemyCharacter = Cast<AEnemyCharacter>(InPawn);
check(EnemyCharacter);
EnemyCharacter->bUseControllerRotationYaw = false;
EnemyCharacter->GetHealthComponent()->OnDamaged.BindUFunction(this, "OnDamaged");
EnemyCharacter->GetHealthComponent()->OnDeath.BindUFunction(this, "OnDeath");

View File

@ -11,6 +11,11 @@ AVampireCharacter::AVampireCharacter()
// Create Health Component
HealthComponent = CreateDefaultSubobject<UHealthComponent>(TEXT("Health Component"));
PaperFlipbookComponent = CreateDefaultSubobject<UPaperFlipbookComponent>(TEXT("Paper Flipbook Component"));
PaperFlipbookComponent->SetRelativeRotation(FRotator(0.0f, 90.0f,-90.0f));
PaperFlipbookComponent->SetRelativeScale3D(FVector(0.2f, 0.2f, 0.2f));
PaperFlipbookComponent->SetupAttachment(RootComponent);
}
// Called when the game starts or when spawned

View File

@ -5,6 +5,7 @@
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "HealthComponent.h"
#include "PaperFlipbookComponent.h"
#include "VampireCharacter.generated.h"
UCLASS()
@ -12,8 +13,11 @@ class VAMPIRES_API AVampireCharacter : public ACharacter
{
GENERATED_BODY()
protected:
public:
UPROPERTY(BlueprintReadWrite, EditAnywhere)
UPaperFlipbookComponent* PaperFlipbookComponent;
protected:
UPROPERTY()
UHealthComponent* HealthComponent;
@ -33,5 +37,4 @@ public:
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
UHealthComponent* GetHealthComponent();
};