| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- linear regression
- 언리얼엔진
- Replication
- 유니티
- os
- UI
- CTF
- gameplay effect
- gameplay tag
- stride
- gas
- unity
- C++
- Multiplay
- Unreal Engine
- animation
- rpc
- photon fusion2
- 게임개발
- gameplay ability system
- widget
- 게임 개발
- listen server
- ability task
- MAC
- Aegis
- local prediction
- 보안
- attribute
- 언리얼 엔진
Archives
- Today
- Total
Replicated
[Drag Down] 게임 엔딩 제작 본문

눈 맵의 끝에서 전투기를 타고 지구를 탈출한다

F를 누르면 전투기가 출발하고 지구를 떠나며, 페이드 아웃이 된다


그 후, 승자와 다른 사람들을 다른 맵으로 이동시킨다.
버튼을 누르면 메인 메뉴로 돌아간다.
// Fill out your copyright notice in the Description page of Project Settings.
#include "Game/DDPlayingGameMode.h"
#include "Game/DDPlayingGameState.h"
#include "GameFramework/PlayerState.h"
#include "DDPlayingGameMode.h"
#include "Kismet/GameplayStatics.h"
#include "DragDown.h"
ADDPlayingGameMode::ADDPlayingGameMode()
{
bIsWinnerLogout = false;
}
void ADDPlayingGameMode::EndGame(APlayerState* PS)
{
ADDPlayingGameState* GS = Cast<ADDPlayingGameState>( GetWorld()->GetGameState() );
if ( GS->PlayerArray.Num() == 1 )
{
UGameplayStatics::OpenLevel(GetWorld(), FName(*WinnerMapName));
return;
}
GS->SetGameEnded(true);
for ( APlayerState* PlayerState : GS->PlayerArray )
{
APlayerController* PC = PlayerState->GetPlayerController();
if ( PC && !PC->IsLocalController() ) // For Non-Server, Because GameMode is Server Only Actor
{
UE_LOG(LogDD, Log, TEXT("ADDPlayingGameMode::EndGame %s"), *PlayerState->GetName());
if ( PlayerState == PS )
{
bIsWinnerLogout = true;
PC->ClientTravel(WinnerMapName, ETravelType::TRAVEL_Absolute);
}
else
{
PC->ClientTravel(NonWinnerMapName, ETravelType::TRAVEL_Absolute);
}
}
}
}
void ADDPlayingGameMode::Logout(AController* Exiting)
{
Super::Logout(Exiting);
ADDPlayingGameState* GS = Cast<ADDPlayingGameState>(GetWorld()->GetGameState());
if ( GS && GS->PlayerArray.Num() - 1 == 1 )
{
// Only Server Remain
if ( !bIsWinnerLogout )
{
UGameplayStatics::OpenLevel(GetWorld(), FName(*WinnerMapName));
}
else
{
UE_LOG(LogDD, Log, TEXT("Server is not winner"));
UGameplayStatics::OpenLevel(GetWorld(), FName(*NonWinnerMapName));
}
}
}
게임 종료 처리는 게임 모드에서 진행한다
애초에 서버 전용 객체이기에 서버에서 실행된다고 생각하고 구현
EndGame 시 우선 클라이언트들을 전부 내보내고,
Logout 함수를 통해 확실히 클라이언트가 전부 나갔다고 판정되면 서버도 맵 이동
* 서버가 먼저 멀티플레이를 나가버리면 네트워크 문제 발생 가능
'언리얼 엔진 > Drag Down' 카테고리의 다른 글
| [Drag Down] 배포된 백엔드에 연결 / Config 파일 사용 (0) | 2025.06.09 |
|---|---|
| [Drag Down] 맵디자인 테마3, 눈 (0) | 2025.06.01 |
| [Drag Down] Patrol 몬스터 추가 (0) | 2025.05.26 |
| ** [Drag Down] 채팅 기능 구현 (Chatting) ** (0) | 2025.05.24 |
| [Drag Down] 맵 이동 포탈 (0) | 2025.05.21 |