From 9999ef2d37b30734c192928763ffcfb210cdce35 Mon Sep 17 00:00:00 2001 From: Kingsmedia Date: Sat, 7 May 2022 17:11:53 +0200 Subject: [PATCH] 98 - Blaster Game Mode --- .../GameModes/BP_BlasterGameMode.uasset | Bin 19904 -> 20014 bytes Source/Blaster/BlasterGameModeBase.cpp | 5 ----- Source/Blaster/BlasterGameModeBase.h | 17 --------------- Source/Blaster/Character/BlasterCharacter.cpp | 19 ++++++++++++++++- Source/Blaster/Character/BlasterCharacter.h | 1 + Source/Blaster/GameMode/BlasterGameMode.cpp | 10 +++++++++ Source/Blaster/GameMode/BlasterGameMode.h | 20 ++++++++++++++++++ 7 files changed, 49 insertions(+), 23 deletions(-) delete mode 100644 Source/Blaster/BlasterGameModeBase.cpp delete mode 100644 Source/Blaster/BlasterGameModeBase.h create mode 100644 Source/Blaster/GameMode/BlasterGameMode.cpp create mode 100644 Source/Blaster/GameMode/BlasterGameMode.h diff --git a/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset b/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset index aa6573fe296b0d2b0cc5f9e3598e6ccce09fc13e..8f0251844c1b4078805a6682073d40356d83dee1 100644 GIT binary patch delta 1752 zcma)-e@IhN6vywK4yI0U)6H!dxqeKtXj-5nr)K^tokl29n$GEFS?YBD3@QoyGeJ2; zg`)IN&`*m;|0zZPMSmnnP#{=fmX(&2W@@f;pVxTF9(LgD+<~9X7q$m9JfXjasmAYx;0ZZ?0?o!(B(DX zpFJ`#02S0gJD{Bwnfxfn7a}h)KbqSnOwvA;Ap+N}Mb*CA#un?LI#+Xx$4BPesv+nM zJtvBMG1pb^De$^I0xF+TIVCD5`7Wm==Trt%rZJ~pR`JRzjRBR9 zxLcE~;tQyJz#ONn;*wRWWR*HurBzmGmsRotDpOc>+doP(ziSpsm=d!77Mj5xu~qkX zCgDzO;4aH>WgED08LnKmq6(&1eqhy-R`EOS29F&QL-y*GmYr$yY{dF+S_aq{V74& zatr%GV>`#OT(rhq@xn$mD)yk3IY|n`&WaEryD(b#_?ko9eO7|9bKB6@3sG})WDWf$ zL9zdlb_qJg(dQxxWjZya>kW#b0(J-t>J!2-*}sDR8+{eV_1Be`up=5^z+eK1Hfg$X zR*X%T8LK%G29tEcSo8sEj>Bmtw#4SR4GnTH?{;7@#%@jtPUD>|n`5vo+4Ub(e{!CR z{T1L7QJ76O(`6yTRvbi^!IM&=lfD6jh&r^3EWl{WLAnAOdkjR_gCWswq^po`FQrRx z%l=Tggg27{g|;2gnfjQ{LsLeKa4hW}rSrmSx{rmXjQ3PIk60F7>pr17)2iUyn{1Z? bw&%YRk`7NRU@`x^l2s4|i8h1K>#)*4uEN8O delta 1881 zcma)-e@IhN6vywKE=)H|r*kf2nz5y%rV^9(X4*8#X8mDAsHjt?nL2+=lR%Pw{1H(k z93oMnp#F*y<speENQKC61U(^f-|a`sQsAsMV~t+=i!BFJhp<%R&%?A;tp6=A5zPa zMU2$3NUt3EjuCcXHhc#~zg&tCQqS!Ia!uUdi*xPG^%5r7x;IF^A=efp*B%5nk9w7) zcbg1!5(ZWUDOepOcTMK_^QGGo8@zotAwH#-k8vt=Ve2rMq^ytp~S9|W{!lR z9p(N5LB{DC9ML2ztX4T-{IjDz6nXaPF&$Pf@a7i+;|h-3Sv?M8zEA!44s~`pvhP(^ z?_&;*jzSrShZ>chh1_hx!IVv`4u_&hdV`74VW8F|>RGB$N)VEQ)+qaSNzJ7-=$U>O zPWgcsKT3ZbhoWw{)?f?e~IN=6lam;8cUA&+iC zuaH2uUGAw1Q2{NOeVL9SZT*xmg7zFi`Xf>g_#B)=>;R6Lg~2oEquippedWeapon == nullptr) return; @@ -119,6 +125,17 @@ void ABlasterCharacter::ReceiveDamage(AActor* DamagedActor, float Damage, const UpdateHUDHealth(); PlayHitReactMontage(); + + if (Health == 0.f) + { + ABlasterGameMode* GameMode = GetWorld()->GetAuthGameMode(); + if (GameMode) + { + BlasterPlayerController = BlasterPlayerController == nullptr ? Cast(Controller) : BlasterPlayerController; + ABlasterPlayerController* AttackerController = Cast(InstigatorController); + GameMode->PlayerEliminated(this, BlasterPlayerController, AttackerController); + } + } } void ABlasterCharacter::Tick(float DeltaTime) @@ -421,7 +438,7 @@ void ABlasterCharacter::OnRep_Health() void ABlasterCharacter::UpdateHUDHealth() { - BlasterPlayerController = BlasterPlayerController == nullptr ?Cast(Controller) : BlasterPlayerController; + BlasterPlayerController = BlasterPlayerController == nullptr ? Cast(Controller) : BlasterPlayerController; if (BlasterPlayerController) { BlasterPlayerController->SetHUDHealth(Health, MaxHealth); diff --git a/Source/Blaster/Character/BlasterCharacter.h b/Source/Blaster/Character/BlasterCharacter.h index 8230de3..0ffdf25 100644 --- a/Source/Blaster/Character/BlasterCharacter.h +++ b/Source/Blaster/Character/BlasterCharacter.h @@ -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; diff --git a/Source/Blaster/GameMode/BlasterGameMode.cpp b/Source/Blaster/GameMode/BlasterGameMode.cpp new file mode 100644 index 0000000..abdd53f --- /dev/null +++ b/Source/Blaster/GameMode/BlasterGameMode.cpp @@ -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) +{ + +} diff --git a/Source/Blaster/GameMode/BlasterGameMode.h b/Source/Blaster/GameMode/BlasterGameMode.h new file mode 100644 index 0000000..e5e8b31 --- /dev/null +++ b/Source/Blaster/GameMode/BlasterGameMode.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 "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); +};