init
This commit is contained in:
33
Source/AudioVideoRecord/Variant_Shooter/ShooterGameMode.cpp
Normal file
33
Source/AudioVideoRecord/Variant_Shooter/ShooterGameMode.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user