94 lines
3.0 KiB
C++
94 lines
3.0 KiB
C++
// Project Lab - NHTV Igad
|
|
|
|
#pragma once
|
|
|
|
#include "Blueprint/UserWidget.h"
|
|
#include "IngameSkillTree.h"
|
|
#include <vector>
|
|
#include <map>
|
|
#include "IngameHUD.generated.h"
|
|
|
|
UCLASS()
|
|
class UExperienceBar : public UUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
UFUNCTION(BlueprintImplementableEvent)
|
|
void Update(float rate, int32 level, bool max);
|
|
};
|
|
|
|
struct FStatDisplay
|
|
{
|
|
class UStatBar* hpBar;
|
|
class UStatBar* manaBar;
|
|
class UExperienceBar* expBar;
|
|
class UImage* avatar;
|
|
class UTextBlock* name;
|
|
};
|
|
|
|
UCLASS()
|
|
class UNREALPROJECT_API UIngameHUD : public UUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UIngameHUD(const FObjectInitializer& init);
|
|
virtual void NativeConstruct() override;
|
|
virtual void NativeDestruct() override;
|
|
virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
|
|
|
|
// Sets the player owned character
|
|
void NativeOnAssignCharacter(class ANetworkPossessable* pawn = nullptr, TArray<FIngameSkillTreeSkill> skillsetPrototype = TArray<FIngameSkillTreeSkill>());
|
|
|
|
UFUNCTION(BlueprintImplementableEvent, Category = "HUD")
|
|
void OnAssignCharacter(ANetworkPossessable* pawn);
|
|
|
|
// Called when the character levels up
|
|
void OnLevelUp(TArray<FIngameSkillTreeSkill> updatedSkills);
|
|
|
|
// Updates the displayed cooldowns in the UI with the provided ability states
|
|
void UpdateCooldowns(TArray<class AAbilityState*> abilityStates, class ANetworkPlayer* player);
|
|
|
|
// Called when a character spawns
|
|
// this makes it display a health-bar in the HUD
|
|
void OnCharacterCreated(class ANetworkCharacter* character);
|
|
// Called when a character despawns(destroyed, killed)
|
|
// this removes all the health-bars, etc. for this character
|
|
void OnCharacterDestroyed(class ANetworkCharacter* character);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
class ANetworkPlayer* GetTeamMate() const;
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
class ANetworkPlayer* GetPlayer() const;
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
class ANetworkGhost* GetGhost() const;
|
|
UFUNCTION(BlueprintCallable, Category = "UI")
|
|
class ADefaultPlayerState* GetPlayerState() const;
|
|
|
|
class UMiniMapWidget* miniMap;
|
|
class UToolTipWidget* toolTips;
|
|
class UCombatTextWidget* combatText;
|
|
class UButtonBarSwitcher* buttonBarSwitcher;
|
|
class UCanvasPanel* healthBarLayer;
|
|
|
|
private:
|
|
// This updates an on screen health bar for a given network character
|
|
void m_UpdateHealthBar(class ANetworkCharacter* character, class UHealthBar* bar);
|
|
void m_UpdateStatDisplay(class ADefaultPlayerState* player, const FStatDisplay& statDisplay);
|
|
void m_InitStatDisplay(const FStatDisplay& statDisplay);
|
|
|
|
FStatDisplay m_playerStatDisplay;
|
|
FStatDisplay m_allyStatDisplay;
|
|
|
|
// Maps every character in the game to a health bar widget on-screen
|
|
UPROPERTY()
|
|
TMap<class ANetworkCharacter*, class UHealthBar*> m_healthBars;
|
|
|
|
UPROPERTY()
|
|
class ANetworkPossessable* m_character;
|
|
UPROPERTY()
|
|
class USpellInfoDisplay* m_spellInfoDisplay;
|
|
|
|
uint32 m_myTeam;
|
|
};
|