This commit is contained in:
John
2026-03-11 11:25:15 +05:30
parent bcd6f827d5
commit 0327abb1a0
77 changed files with 7689 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "Variant_Shooter/ShooterGameMode.h"
#include "ShooterUI.h"
#include "Kismet/GameplayStatics.h"
#include "Engine/World.h"
void AShooterGameMode::BeginPlay()
{
Super::BeginPlay();
// create the UI
ShooterUI = CreateWidget<UShooterUI>(UGameplayStatics::GetPlayerController(GetWorld(), 0), ShooterUIClass);
ShooterUI->AddToViewport(0);
}
void AShooterGameMode::IncrementTeamScore(uint8 TeamByte)
{
// retrieve the team score if any
int32 Score = 0;
if (int32* FoundScore = TeamScores.Find(TeamByte))
{
Score = *FoundScore;
}
// increment the score for the given team
++Score;
TeamScores.Add(TeamByte, Score);
// update the UI
ShooterUI->BP_UpdateScore(TeamByte, Score);
}