98 - Blaster Game Mode
This commit is contained in:
parent
835069d362
commit
9999ef2d37
Binary file not shown.
|
@ -1,5 +0,0 @@
|
|||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
|
||||
#include "BlasterGameModeBase.h"
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "BlasterGameModeBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class BLASTER_API ABlasterGameModeBase : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "Blaster/Blaster.h"
|
||||
#include "Blaster/Components/CombatComponent.h"
|
||||
#include "Blaster/GameMode/BlasterGameMode.h"
|
||||
#include "Blaster/PlayerController/BlasterPlayerController.h"
|
||||
#include "Blaster/Weapon/Weapon.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
|
@ -99,6 +100,11 @@ void ABlasterCharacter::PlayFireMontage(bool bAiming)
|
|||
}
|
||||
}
|
||||
|
||||
void ABlasterCharacter::Eliminated()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ABlasterCharacter::PlayHitReactMontage()
|
||||
{
|
||||
if (Combat == nullptr || Combat->EquippedWeapon == nullptr) return;
|
||||
|
@ -119,6 +125,17 @@ void ABlasterCharacter::ReceiveDamage(AActor* DamagedActor, float Damage, const
|
|||
|
||||
UpdateHUDHealth();
|
||||
PlayHitReactMontage();
|
||||
|
||||
if (Health == 0.f)
|
||||
{
|
||||
ABlasterGameMode* GameMode = GetWorld()->GetAuthGameMode<ABlasterGameMode>();
|
||||
if (GameMode)
|
||||
{
|
||||
BlasterPlayerController = BlasterPlayerController == nullptr ? Cast<ABlasterPlayerController>(Controller) : BlasterPlayerController;
|
||||
ABlasterPlayerController* AttackerController = Cast<ABlasterPlayerController>(InstigatorController);
|
||||
GameMode->PlayerEliminated(this, BlasterPlayerController, AttackerController);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ABlasterCharacter::Tick(float DeltaTime)
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
virtual void PostInitializeComponents() override;
|
||||
virtual void OnRep_ReplicatedMovement() override;
|
||||
void PlayFireMontage(bool bAiming);
|
||||
void Eliminated();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "BlasterGameMode.h"
|
||||
|
||||
void ABlasterGameMode::PlayerEliminated(ABlasterCharacter* ElimmedCharacter, ABlasterPlayerController* VictimController,
|
||||
ABlasterPlayerController* AttackerController)
|
||||
{
|
||||
|
||||
}
|
|
@ -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 "BlasterGameMode.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class BLASTER_API ABlasterGameMode : public AGameMode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
virtual void PlayerEliminated(class ABlasterCharacter* ElimmedCharacter, class ABlasterPlayerController* VictimController, class ABlasterPlayerController* AttackerController);
|
||||
};
|
Loading…
Reference in New Issue