diff --git a/Blaster.uproject b/Blaster.uproject index b39c44d..673f04d 100644 --- a/Blaster.uproject +++ b/Blaster.uproject @@ -9,7 +9,8 @@ "Type": "Runtime", "LoadingPhase": "Default", "AdditionalDependencies": [ - "Engine" + "Engine", + "UMG" ] } ], diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index e7739b4..ecee529 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -3,6 +3,7 @@ [/Script/EngineSettings.GameMapsSettings] GameDefaultMap=/Game/Maps/GameStartupMap.GameStartupMap EditorStartupMap=/Game/Maps/GameStartupMap.GameStartupMap +TransitionMap=/Game/Maps/TransitionMap.TransitionMap [/Script/HardwareTargeting.HardwareTargetingSettings] TargetedHardwareClass=Desktop diff --git a/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset b/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset new file mode 100644 index 0000000..2455cb4 Binary files /dev/null and b/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset differ diff --git a/Content/Blueprints/GameModes/BP_LobbyGameMode.uasset b/Content/Blueprints/GameModes/BP_LobbyGameMode.uasset new file mode 100644 index 0000000..b0c505d Binary files /dev/null and b/Content/Blueprints/GameModes/BP_LobbyGameMode.uasset differ diff --git a/Content/Maps/BlasterMap.umap b/Content/Maps/BlasterMap.umap new file mode 100644 index 0000000..9387952 Binary files /dev/null and b/Content/Maps/BlasterMap.umap differ diff --git a/Content/Maps/GameStartupMap.umap b/Content/Maps/GameStartupMap.umap deleted file mode 100644 index a012796..0000000 Binary files a/Content/Maps/GameStartupMap.umap and /dev/null differ diff --git a/Content/Maps/Lobby.umap b/Content/Maps/Lobby.umap index c2866bc..562cea8 100644 Binary files a/Content/Maps/Lobby.umap and b/Content/Maps/Lobby.umap differ diff --git a/Content/Maps/TransitionMap.umap b/Content/Maps/TransitionMap.umap new file mode 100644 index 0000000..ca181b9 Binary files /dev/null and b/Content/Maps/TransitionMap.umap differ diff --git a/Source/Blaster/GameMode/LobbyGameMode.cpp b/Source/Blaster/GameMode/LobbyGameMode.cpp new file mode 100644 index 0000000..7328805 --- /dev/null +++ b/Source/Blaster/GameMode/LobbyGameMode.cpp @@ -0,0 +1,22 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "LobbyGameMode.h" + +#include "GameFramework/GameStateBase.h" + +void ALobbyGameMode::PostLogin(APlayerController* NewPlayer) +{ + Super::PostLogin(NewPlayer); + + int32 NumberOfPlayers = GameState.Get()->PlayerArray.Num(); + if (NumberOfPlayers == 2) + { + UWorld* World = GetWorld(); + if (World) + { + bUseSeamlessTravel = true; + World->ServerTravel(FString("/Game/Maps/BlasterMap?listen")); + } + } +} diff --git a/Source/Blaster/GameMode/LobbyGameMode.h b/Source/Blaster/GameMode/LobbyGameMode.h new file mode 100644 index 0000000..5637717 --- /dev/null +++ b/Source/Blaster/GameMode/LobbyGameMode.h @@ -0,0 +1,20 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/GameMode.h" +#include "LobbyGameMode.generated.h" + +/** + * + */ +UCLASS() +class BLASTER_API ALobbyGameMode : public AGameMode +{ + GENERATED_BODY() + +public: + + virtual void PostLogin(APlayerController* NewPlayer) override; +};