diff --git a/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A.uasset b/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A.uasset index fe6f865..03bc1a0 100644 Binary files a/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A.uasset and b/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A.uasset differ diff --git a/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A_Skeleton.uasset b/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A_Skeleton.uasset index e368764..4b4c2f6 100644 Binary files a/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A_Skeleton.uasset and b/Content/Assets/MilitaryWeapSilver/Weapons/Rocket_Launcher_A_Skeleton.uasset differ diff --git a/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset b/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset index 5ec6340..69e1aae 100644 Binary files a/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset and b/Content/Blueprints/GameModes/BP_BlasterGameMode.uasset differ diff --git a/Content/Blueprints/Weapon/BP_RocketLauncher.uasset b/Content/Blueprints/Weapon/BP_RocketLauncher.uasset new file mode 100644 index 0000000..d48a0fd Binary files /dev/null and b/Content/Blueprints/Weapon/BP_RocketLauncher.uasset differ diff --git a/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset b/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset new file mode 100644 index 0000000..9609a36 Binary files /dev/null and b/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset differ diff --git a/Content/Maps/BlasterMap.umap b/Content/Maps/BlasterMap.umap index bee7114..9db2870 100644 Binary files a/Content/Maps/BlasterMap.umap and b/Content/Maps/BlasterMap.umap differ diff --git a/Source/Blaster/Components/CombatComponent.cpp b/Source/Blaster/Components/CombatComponent.cpp index 0deca32..a0803fc 100644 --- a/Source/Blaster/Components/CombatComponent.cpp +++ b/Source/Blaster/Components/CombatComponent.cpp @@ -455,4 +455,5 @@ void UCombatComponent::OnRep_CarriedAmmo() void UCombatComponent::InitializeCarriedAmmo() { CarriedAmmoMap.Emplace(EWeaponType::EWT_AssaultRifle, StartingARAmmo); + CarriedAmmoMap.Emplace(EWeaponType::EWT_RocketLauncher, StartingRocketAmmo); } diff --git a/Source/Blaster/Components/CombatComponent.h b/Source/Blaster/Components/CombatComponent.h index a53d39d..f5b6471 100644 --- a/Source/Blaster/Components/CombatComponent.h +++ b/Source/Blaster/Components/CombatComponent.h @@ -123,6 +123,9 @@ private: UPROPERTY(EditAnywhere) int32 StartingARAmmo = 30; + UPROPERTY(EditAnywhere) + int32 StartingRocketAmmo = 8; + void InitializeCarriedAmmo(); UPROPERTY(ReplicatedUsing=OnRep_CombatState) diff --git a/Source/Blaster/PlayerController/BlasterPlayerController.cpp b/Source/Blaster/PlayerController/BlasterPlayerController.cpp index c5d05b5..287d442 100644 --- a/Source/Blaster/PlayerController/BlasterPlayerController.cpp +++ b/Source/Blaster/PlayerController/BlasterPlayerController.cpp @@ -391,7 +391,7 @@ void ABlasterPlayerController::HandleMatchHasStarted() BlasterHUD = BlasterHUD == nullptr ? Cast(GetHUD()) : BlasterHUD; if (BlasterHUD) { - BlasterHUD->AddCharacterOverlay(); + if (BlasterHUD->CharacterOverlay == nullptr) BlasterHUD->AddCharacterOverlay(); if (BlasterHUD->Announcement) { BlasterHUD->Announcement->SetVisibility(ESlateVisibility::Hidden); diff --git a/Source/Blaster/Weapon/ProjectileRocket.cpp b/Source/Blaster/Weapon/ProjectileRocket.cpp new file mode 100644 index 0000000..8d79d68 --- /dev/null +++ b/Source/Blaster/Weapon/ProjectileRocket.cpp @@ -0,0 +1,39 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "ProjectileRocket.h" + +#include "Kismet/GameplayStatics.h" + +AProjectileRocket::AProjectileRocket() +{ + RocketMesh = CreateDefaultSubobject(TEXT("Rocket Mesh")); + RocketMesh->SetupAttachment(RootComponent); + RocketMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision); +} + +void AProjectileRocket::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) +{ + APawn* FiringPawn = GetInstigator(); + if (FiringPawn) + { + AController* FiringController = FiringPawn->GetController(); + if (FiringController) + { + UGameplayStatics::ApplyRadialDamageWithFalloff( + this, + Damage, + 10.f, + GetActorLocation(), + 200.f, + 500.f, + 1.f, + UDamageType::StaticClass(), + TArray(), + this, + FiringController + ); + } + } + Super::OnHit(HitComp, OtherActor, OtherComp, NormalImpulse, Hit); +} diff --git a/Source/Blaster/Weapon/ProjectileRocket.h b/Source/Blaster/Weapon/ProjectileRocket.h new file mode 100644 index 0000000..08701da --- /dev/null +++ b/Source/Blaster/Weapon/ProjectileRocket.h @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Projectile.h" +#include "ProjectileRocket.generated.h" + +/** + * + */ +UCLASS() +class BLASTER_API AProjectileRocket : public AProjectile +{ + GENERATED_BODY() +public: + AProjectileRocket(); + +protected: + + virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) override; + +private: + + UPROPERTY(VisibleAnywhere) + UStaticMeshComponent* RocketMesh; +}; diff --git a/Source/Blaster/Weapon/WeaponTypes.h b/Source/Blaster/Weapon/WeaponTypes.h index cd36a2a..4dd0a4a 100644 --- a/Source/Blaster/Weapon/WeaponTypes.h +++ b/Source/Blaster/Weapon/WeaponTypes.h @@ -4,6 +4,7 @@ UENUM(BlueprintType) enum class EWeaponType: uint8 { EWT_AssaultRifle UMETA(DisplayName="Assault Rifle"), + EWT_RocketLauncher UMETA(DisplayName="Rocket Launcher"), EWT_MAX UMETA(DisplayName="DefaultMAX") }; \ No newline at end of file