changed map and added music and sounds

feature-map-and-sounds
m4xxx1m 2 years ago
parent 648d230cd9
commit 6e1fd803f1

@ -19,6 +19,7 @@ ABattleGameMode::ABattleGameMode()
void ABattleGameMode::BeginPlay() {
Super::BeginPlay();
// UGameplayStatics::PlaySound2D(GetWorld(), BackgroundSound);
}
auto ABattleGameMode::GetMyGameState() const {
@ -137,6 +138,8 @@ void ABattleGameMode::PostLogin(APlayerController *NewPlayer) {
// 0-indexation
Cast<ABattlePlayerController>(NewPlayer)->SetPlayerIndex(
CurrentNumberOfPlayers - 1);
Cast<ABattlePlayerController>(NewPlayer)->
StartPlayingMusic(BackgroundSound);
UE_LOG(LogTemp, Warning, TEXT("%d"), CurrentNumberOfPlayers);
if (CurrentNumberOfPlayers == 2) {
UE_LOG(LogTemp, Warning, TEXT("Game Start"));

@ -27,6 +27,9 @@ public:
// void CycleTurns();
protected:
UPROPERTY(BlueprintReadWrite, EditAnywhere)
USoundBase *BackgroundSound;
UPROPERTY()
TArray<UClass *> LoadedBpAssets;

@ -147,6 +147,11 @@ uint8 ABattlePlayerController::GetPlayerIndex() const {
return PlayerIndex;
}
void ABattlePlayerController::StartPlayingMusic_Implementation(
USoundBase *BackgroundSound) const {
UGameplayStatics::PlaySound2D(GetWorld(), BackgroundSound);
}
// float AMyPlayerController::SetCurrentActionAndReturnRadius(int action) {
// return GetMyPlayerState()->SetCurrentActionAndReturnRadius(action);
//

@ -50,6 +50,9 @@ public:
// UFUNCTION(Client, Reliable)
// void SetEnemySelection(const TArray<ATrooper *> &Troopers) const;
UFUNCTION(Client, Reliable)
void StartPlayingMusic(USoundBase *BackgroundSound) const;
private:
UPROPERTY(EditAnywhere)
TSubclassOf<UUserWidget> WidgetClass;

@ -156,8 +156,9 @@ void ABattlePlayerState::OnPlayerAction(const FHitResult &HitResult) {
return;
}
if (NewlySelectedTrooper == nullptr || !NewlySelectedTrooper->
IsValidLowLevel() || NewlySelectedTrooper->GetPlayerIndex() !=
if (HitResult.GetActor()->ActorHasTag(FName("Floor")) ||
NewlySelectedTrooper != nullptr &&
NewlySelectedTrooper->GetPlayerIndex() !=
PlayerIndex) {
if (SelectedTrooper != nullptr && SelectedTrooper->
IsValidLowLevel()) {

@ -2,6 +2,7 @@
#include "SinglePlayerGM.h"
#include "SinglePlayerGS.h"
#include "TurnBasedTutorial/BattleMode/BattlePlayerController.h"
ASinglePlayerGM::ASinglePlayerGM()
: Super() {
@ -18,4 +19,6 @@ void ASinglePlayerGM::BeginPlay() {
void ASinglePlayerGM::PostLogin(APlayerController *NewPlayer) {
AGameMode::PostLogin(NewPlayer);
Cast<ABattlePlayerController>(NewPlayer)->
StartPlayingMusic(BackgroundSound);
}

@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "4.27",
"EngineAssociation": "{B4FE6467-4579-3D84-B22A-558A3D607596}",
"Category": "",
"Description": "",
"Modules": [

Loading…
Cancel
Save