Setup Mission End
Posted suomeimei
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Setup Mission End相关的知识,希望对你有一定的参考价值。
编写FPSGameMode
新建函数OnMissionComplete,并设置为蓝图可实现事件
UFUNCTION(BlueprintImplementableEvent,Category="GameMode") void OnMissionComplete(APawn* InstigatorPawn);
新建函数CompleteMission
void CompleteMission(APawn* InstigatorPawn);//确保其设在public下,能够从ExtractionZone调用
实现
void AFPSGameMode::CompleteMission(APawn* InstigatorPawn) { if (InstigatorPawn) { InstigatorPawn->DisableInput(nullptr);//禁用玩家控制器对它的控制 } OnMissionComplete(InstigatorPawn); }
实现HandleOverlap函数
void AFPSExtractionZone::HandleOverlap(UPrimitiveComponent * OverlappedComponent, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult) { AFPSCharacter* MyPawn = Cast<AFPSCharacter>(OtherActor); if (MyPawn == nullptr) { return; } if (MyPawn->bIsCarryingObjective) { AFPSGameMode* GM = Cast<AFPSGameMode>(GetWorld()->GetAuthGameMode()); if (GM) { GM->CompleteMission(MyPawn); } } else { UGameplayStatics::PlaySound2D(this, ObjectiveMissingSound); } }
以上是关于Setup Mission End的主要内容,如果未能解决你的问题,请参考以下文章
json 单击VSCode的setup.py片段(可能还有其他编辑器)
19 01 11 javascript ?????????????????????(???????????????) ??????????????????????????????(代码片段