From 559977e0cf1dae50ed7034ca94832007f2e94df8 Mon Sep 17 00:00:00 2001 From: Rafal Swierczek Date: Sat, 13 Jan 2024 03:29:54 +0000 Subject: [PATCH] Implemented Target Dummy with Getting Shot Functionality --- .../.idea.EndlessVendetta/.idea/workspace.xml | 10 ++----- .../GunRangeMechanics/Target/BP_Target.uasset | 4 +-- .../Content/Levels/ControlTutorialLevel.umap | 4 +-- .../ControlsTraining/TargetDummy.cpp | 27 ++++++++++++++++++ .../ControlsTraining/TargetDummy.h | 28 +++++++++++++++++++ .../WeaponSystem/BaseWeaponClass.cpp | 3 ++ 6 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.cpp create mode 100644 EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.h diff --git a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml index 19196a33..78694969 100644 --- a/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml +++ b/EndlessVendetta/.idea/.idea.EndlessVendetta/.idea/workspace.xml @@ -9,12 +9,8 @@ - - - - - - + + diff --git a/EndlessVendetta/Content/BountySystem/ControlsTutorial/GunRangeMechanics/Target/BP_Target.uasset b/EndlessVendetta/Content/BountySystem/ControlsTutorial/GunRangeMechanics/Target/BP_Target.uasset index f9fd3a71..0cfa4ad9 100644 --- a/EndlessVendetta/Content/BountySystem/ControlsTutorial/GunRangeMechanics/Target/BP_Target.uasset +++ b/EndlessVendetta/Content/BountySystem/ControlsTutorial/GunRangeMechanics/Target/BP_Target.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bcbd04ff5a9706023358d5ab845dfb2dacc9bddaac778844750dabd821878a8f -size 27651 +oid sha256:9f3acba0c9e6d6625b93b61cfe439b686c61293c2ecbe7572a0a3c606ee4dfe4 +size 63784 diff --git a/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap b/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap index 44c8c5a4..8f32da32 100644 --- a/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap +++ b/EndlessVendetta/Content/Levels/ControlTutorialLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:80223e45e684837efa4a66de2e409345e8c3057ef1d734acb2475fd2184d080a -size 238358 +oid sha256:a1a53464c35266216d4a8cdc127a908d9c74e93515e846e2c5324247048be12e +size 240946 diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.cpp b/EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.cpp new file mode 100644 index 00000000..1b27b8b9 --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.cpp @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "TargetDummy.h" + +// Sets default values +ATargetDummy::ATargetDummy() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void ATargetDummy::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void ATargetDummy::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + diff --git a/EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.h b/EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.h new file mode 100644 index 00000000..56c492ff --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.h @@ -0,0 +1,28 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "TargetDummy.generated.h" + +UCLASS() +class ENDLESSVENDETTA_API ATargetDummy : public AActor +{ + GENERATED_BODY() + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Sets default values for this actor's properties + ATargetDummy(); + + // Called every frame + virtual void Tick(float DeltaTime) override; + + UFUNCTION(BlueprintImplementableEvent) + void TargetShot(); + +}; diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index 6ebc5b94..9d14975d 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -12,6 +12,8 @@ #include "EndlessVendetta/AI/EnemyCharacter.h" #include +#include "EndlessVendetta/BountySystem/ControlsTraining/TargetDummy.h" + // Sets default values ABaseWeaponClass::ABaseWeaponClass() @@ -192,6 +194,7 @@ void ABaseWeaponClass::Fire() { tempWeaponDamage = WeaponDamage; } + if (ATargetDummy* TargetDummy = Cast(outHit.GetActor())) TargetDummy->TargetShot(); if (!Cast(outHit.GetActor())) return; Cast(outHit.GetActor())->TakeDamage(tempWeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this); }