DungeonCrawler-UE-C/Source/DungeonCrawlerUE/Variant_SideScrolling/SideScrollingGameMode.cpp
sandr fc08cd0c0b Initial commit – UE5 DungeonCrawler project mit Planung v4.2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 22:17:14 +02:00

35 lines
No EOL
830 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SideScrollingGameMode.h"
#include "Kismet/GameplayStatics.h"
#include "Blueprint/UserWidget.h"
#include "SideScrollingUI.h"
#include "SideScrollingPickup.h"
void ASideScrollingGameMode::BeginPlay()
{
Super::BeginPlay();
// create the game UI
APlayerController* OwningPlayer = UGameplayStatics::GetPlayerController(GetWorld(), 0);
UserInterface = CreateWidget<USideScrollingUI>(OwningPlayer, UserInterfaceClass);
check(UserInterface);
}
void ASideScrollingGameMode::ProcessPickup()
{
// increment the pickups counter
++PickupsCollected;
// if this is the first pickup we collect, show the UI
if (PickupsCollected == 1)
{
UserInterface->AddToViewport(0);
}
// update the pickups counter on the UI
UserInterface->UpdatePickups(PickupsCollected);
}