Compare commits
No commits in common. "48bb8f9ef6eb15c742154e28a84fffd5212fe3ba" and "98e49a913df0a2a9a87983aa85dac4b0f848b36c" have entirely different histories.
48bb8f9ef6
...
98e49a913d
|
@ -1,38 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "LevelEndTriggerVolume.h"
|
||||
|
||||
#include <Kismet/GameplayStatics.h>
|
||||
|
||||
#include "PlayerCharacter.h"
|
||||
|
||||
void ALevelEndTriggerVolume::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
// OnActorBeginOverlap.AddDynamic(this, &ALevelEndTriggerVolume::OnOverlapBegin);
|
||||
|
||||
}
|
||||
|
||||
ALevelEndTriggerVolume::ALevelEndTriggerVolume()
|
||||
{
|
||||
GetCollisionComponent()->OnComponentBeginOverlap.AddDynamic(this, &ALevelEndTriggerVolume::OnOverlapBegin);
|
||||
}
|
||||
|
||||
void ALevelEndTriggerVolume::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
||||
const FHitResult& SweepResult)
|
||||
{
|
||||
// TODO: Add extra functionality!
|
||||
if (Cast<APlayerCharacter>(OtherActor))
|
||||
{
|
||||
GetCollisionComponent()->OnComponentBeginOverlap.Clear();
|
||||
|
||||
if (!NextGameLevel.IsNull())
|
||||
{
|
||||
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NextGameLevel);
|
||||
}
|
||||
|
||||
this->Destroy();
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/TriggerBox.h"
|
||||
#include "LevelEndTriggerVolume.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKATOMI_API ALevelEndTriggerVolume : public ATriggerBox
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
ALevelEndTriggerVolume();
|
||||
|
||||
UFUNCTION()
|
||||
void OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
||||
const FHitResult& SweepResult);
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSoftObjectPtr<UWorld> NextGameLevel;
|
||||
};
|
|
@ -99,6 +99,10 @@ void APlayerCharacter::BeginPlay()
|
|||
|
||||
void APlayerCharacter::Destroyed()
|
||||
{
|
||||
FString map = GetWorld()->GetMapName();
|
||||
map.RemoveFromStart("UEDPIE_0_"); // We have to remove this for reason, I don't fully understand at the moment
|
||||
UGameplayStatics::OpenLevel(this, FName(map), false);
|
||||
|
||||
Super::Destroyed();
|
||||
}
|
||||
|
||||
|
@ -441,11 +445,6 @@ void APlayerCharacter::OnDeath()
|
|||
|
||||
IsFiring = false;
|
||||
ClearAllTimers();
|
||||
|
||||
// TODO: Move this out into it's own method.
|
||||
FString map = GetWorld()->GetMapName();
|
||||
map.RemoveFromStart("UEDPIE_0_"); // We have to remove this for reason, I don't fully understand at the moment
|
||||
UGameplayStatics::OpenLevel(this, FName(map), false);
|
||||
}
|
||||
|
||||
void APlayerCharacter::SetMovementSpeed()
|
||||
|
|
Loading…
Reference in New Issue