İlk yürütme
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
|
||||
#include "HorrorUI.h"
|
||||
#include "HorrorCharacter.h"
|
||||
|
||||
void UHorrorUI::SetupCharacter(AHorrorCharacter* HorrorCharacter)
|
||||
{
|
||||
HorrorCharacter->OnSprintMeterUpdated.AddDynamic(this, &UHorrorUI::OnSprintMeterUpdated);
|
||||
HorrorCharacter->OnSprintStateChanged.AddDynamic(this, &UHorrorUI::OnSprintStateChanged);
|
||||
}
|
||||
|
||||
void UHorrorUI::OnSprintMeterUpdated(float Percent)
|
||||
{
|
||||
// call the BP handler
|
||||
BP_SprintMeterUpdated(Percent);
|
||||
}
|
||||
|
||||
void UHorrorUI::OnSprintStateChanged(bool bSprinting)
|
||||
{
|
||||
// call the BP handler
|
||||
BP_SprintStateChanged(bSprinting);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "HorrorUI.generated.h"
|
||||
|
||||
class AHorrorCharacter;
|
||||
|
||||
/**
|
||||
* Simple UI for a first person horror game
|
||||
* Manages character sprint meter display
|
||||
*/
|
||||
UCLASS(abstract)
|
||||
class FIRST_API UHorrorUI : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
/** Sets up delegate listeners for the passed character */
|
||||
void SetupCharacter(AHorrorCharacter* HorrorCharacter);
|
||||
|
||||
/** Called when the character's sprint meter is updated */
|
||||
UFUNCTION()
|
||||
void OnSprintMeterUpdated(float Percent);
|
||||
|
||||
/** Called when the character's sprint state changes */
|
||||
UFUNCTION()
|
||||
void OnSprintStateChanged(bool bSprinting);
|
||||
|
||||
protected:
|
||||
|
||||
/** Passes control to Blueprint to update the sprint meter widgets */
|
||||
UFUNCTION(BlueprintImplementableEvent, Category="Horror", meta = (DisplayName = "Sprint Meter Updated"))
|
||||
void BP_SprintMeterUpdated(float Percent);
|
||||
|
||||
/** Passes control to Blueprint to update the sprint meter status */
|
||||
UFUNCTION(BlueprintImplementableEvent, Category="Horror", meta = (DisplayName = "Sprint State Changed"))
|
||||
void BP_SprintStateChanged(bool bSprinting);
|
||||
};
|
||||
Reference in New Issue
Block a user