// Project Lab - NHTV Igad #pragma once #include "Blueprint/UserWidget.h" #include "IngameSkillTree.h" #include #include #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 skillsetPrototype = TArray()); UFUNCTION(BlueprintImplementableEvent, Category = "HUD") void OnAssignCharacter(ANetworkPossessable* pawn); // Called when the character levels up void OnLevelUp(TArray updatedSkills); // Updates the displayed cooldowns in the UI with the provided ability states void UpdateCooldowns(TArray 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 m_healthBars; UPROPERTY() class ANetworkPossessable* m_character; UPROPERTY() class USpellInfoDisplay* m_spellInfoDisplay; uint32 m_myTeam; };