diff --git a/Content/Assets/Sounds/Pickups/Pickup_Jump_Cue.uasset b/Content/Assets/Sounds/Pickups/Pickup_Jump_Cue.uasset new file mode 100644 index 0000000..2ca9e68 Binary files /dev/null and b/Content/Assets/Sounds/Pickups/Pickup_Jump_Cue.uasset differ diff --git a/Content/Assets/Sounds/Pickups/Special_Powerup_03_wav.uasset b/Content/Assets/Sounds/Pickups/Special_Powerup_03_wav.uasset new file mode 100644 index 0000000..6f08497 Binary files /dev/null and b/Content/Assets/Sounds/Pickups/Special_Powerup_03_wav.uasset differ diff --git a/Content/Assets/Sounds/Pickups/Special_Powerup_08_wav.uasset b/Content/Assets/Sounds/Pickups/Special_Powerup_08_wav.uasset new file mode 100644 index 0000000..d2366a2 Binary files /dev/null and b/Content/Assets/Sounds/Pickups/Special_Powerup_08_wav.uasset differ diff --git a/Content/Assets/Sounds/Pickups/Speed_Buff_Cue.uasset b/Content/Assets/Sounds/Pickups/Speed_Buff_Cue.uasset index 88eee1d..30686f3 100644 Binary files a/Content/Assets/Sounds/Pickups/Speed_Buff_Cue.uasset and b/Content/Assets/Sounds/Pickups/Speed_Buff_Cue.uasset differ diff --git a/Content/Assets/Sounds/Pickups/sw_Amb_OS_26.uasset b/Content/Assets/Sounds/Pickups/sw_Amb_OS_26.uasset index 1a21735..3f0c730 100644 Binary files a/Content/Assets/Sounds/Pickups/sw_Amb_OS_26.uasset and b/Content/Assets/Sounds/Pickups/sw_Amb_OS_26.uasset differ diff --git a/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Energy_2.uasset b/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Energy_2.uasset index b63aa43..f22c62f 100644 Binary files a/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Energy_2.uasset and b/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Energy_2.uasset differ diff --git a/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Magic_3.uasset b/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Magic_3.uasset new file mode 100644 index 0000000..a0d7b12 Binary files /dev/null and b/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Magic_3.uasset differ diff --git a/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Pickup_5.uasset b/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Pickup_5.uasset index 443d78b..387b8f9 100644 Binary files a/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Pickup_5.uasset and b/Content/Assets/sA_PickupSet_1/Fx/NiagaraSystems/NS_Pickup_5.uasset differ diff --git a/Content/Blueprints/Pickups/Buff/BP_JumpPickup.uasset b/Content/Blueprints/Pickups/Buff/BP_JumpPickup.uasset new file mode 100644 index 0000000..b1c8fa9 Binary files /dev/null and b/Content/Blueprints/Pickups/Buff/BP_JumpPickup.uasset differ diff --git a/Content/Maps/BlasterMap.umap b/Content/Maps/BlasterMap.umap index 0f8bd6d..4ccb630 100644 Binary files a/Content/Maps/BlasterMap.umap and b/Content/Maps/BlasterMap.umap differ diff --git a/Source/Blaster/Character/BlasterCharacter.cpp b/Source/Blaster/Character/BlasterCharacter.cpp index 59bb229..d717b9a 100644 --- a/Source/Blaster/Character/BlasterCharacter.cpp +++ b/Source/Blaster/Character/BlasterCharacter.cpp @@ -257,6 +257,7 @@ void ABlasterCharacter::PostInitializeComponents() { Buff->Character = this; Buff->SetInitialSpeeds(GetCharacterMovement()->MaxWalkSpeed, GetCharacterMovement()->MaxWalkSpeedCrouched); + Buff->SetInitialJumpVelocity(GetCharacterMovement()->JumpZVelocity); } } diff --git a/Source/Blaster/Components/BuffComponent.cpp b/Source/Blaster/Components/BuffComponent.cpp index c1f034d..c25a737 100644 --- a/Source/Blaster/Components/BuffComponent.cpp +++ b/Source/Blaster/Components/BuffComponent.cpp @@ -9,7 +9,6 @@ UBuffComponent::UBuffComponent() { PrimaryComponentTick.bCanEverTick = true; - } void UBuffComponent::Heal(float HealAmount, float HealingTime) @@ -22,7 +21,6 @@ void UBuffComponent::Heal(float HealAmount, float HealingTime) void UBuffComponent::BeginPlay() { Super::BeginPlay(); - } void UBuffComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) @@ -70,7 +68,7 @@ void UBuffComponent::BuffSpeed(float BuffBaseSpeed, float BuffCrouchSpeed, float void UBuffComponent::MulticastSpeedBuff_Implementation(float BaseSpeed, float CrouchSpeed) { - if (Character->GetCharacterMovement()) + if (Character && Character->GetCharacterMovement()) { Character->GetCharacterMovement()->MaxWalkSpeed = BaseSpeed; Character->GetCharacterMovement()->MaxWalkSpeedCrouched = CrouchSpeed; @@ -92,3 +90,43 @@ void UBuffComponent::SetInitialSpeeds(float BaseSpeed, float CrouchSpeed) InitialBaseSpeed = BaseSpeed; InitialCrouchSpeed = CrouchSpeed; } + +void UBuffComponent::SetInitialJumpVelocity(float Velocity) +{ + InitialJumpZVelocity = Velocity; +} + +void UBuffComponent::BuffJump(float BuffJumpVelocity, float BuffTime) +{ + if (Character == nullptr) return; + + Character->GetWorldTimerManager().SetTimer( + JumpBuffTimer, + this, + &UBuffComponent::ResetJump, + BuffTime + ); + + if (Character->GetCharacterMovement()) + { + Character->GetCharacterMovement()->JumpZVelocity = BuffJumpVelocity; + MulticastJumpBuff(BuffJumpVelocity); + } +} + +void UBuffComponent::MulticastJumpBuff_Implementation(float JumpVelocity) +{ + if (Character && Character->GetCharacterMovement()) + { + Character->GetCharacterMovement()->JumpZVelocity = JumpVelocity; + } +} + +void UBuffComponent::ResetJump() +{ + if (Character && Character->GetCharacterMovement()) + { + Character->GetCharacterMovement()->JumpZVelocity = InitialJumpZVelocity; + MulticastJumpBuff(InitialJumpZVelocity); + } +} diff --git a/Source/Blaster/Components/BuffComponent.h b/Source/Blaster/Components/BuffComponent.h index 4a7d4aa..5b4e5f1 100644 --- a/Source/Blaster/Components/BuffComponent.h +++ b/Source/Blaster/Components/BuffComponent.h @@ -18,7 +18,9 @@ public: void Heal(float HealAmount, float HealingTime); void BuffSpeed(float BuffBaseSpeed, float BuffCrouchSpeed, float BuffTime); + void BuffJump(float BuffJumpVelocity, float BuffTime); void SetInitialSpeeds(float BaseSpeed, float CrouchSpeed); + void SetInitialJumpVelocity(float Velocity); protected: virtual void BeginPlay() override; void HealRampUp(float DeltaTime); @@ -40,6 +42,16 @@ private: UFUNCTION(NetMulticast, Reliable) void MulticastSpeedBuff(float BaseSpeed, float CrouchSpeed); + + // Jump Buff + + FTimerHandle JumpBuffTimer; + void ResetJump(); + float InitialJumpZVelocity; + + UFUNCTION(NetMulticast, Reliable) + void MulticastJumpBuff(float JumpVelocity); + public: virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; }; diff --git a/Source/Blaster/Pickups/JumpPickup.cpp b/Source/Blaster/Pickups/JumpPickup.cpp new file mode 100644 index 0000000..a461153 --- /dev/null +++ b/Source/Blaster/Pickups/JumpPickup.cpp @@ -0,0 +1,26 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "JumpPickup.h" + +#include "Blaster/Character/BlasterCharacter.h" +#include "Blaster/Components/BuffComponent.h" + +void AJumpPickup::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, + bool bFromSweep, const FHitResult& SweepResult) +{ + Super::OnSphereOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult); + + ABlasterCharacter* BlasterCharacter = Cast(OtherActor); + if (BlasterCharacter) + { + UBuffComponent* Buff = BlasterCharacter->GetBuff(); + if (Buff) + { + Buff->BuffJump(JumpZVelocity, JumpBuffTime); + } + } + + Destroy(); +} + diff --git a/Source/Blaster/Pickups/JumpPickup.h b/Source/Blaster/Pickups/JumpPickup.h new file mode 100644 index 0000000..17a15f8 --- /dev/null +++ b/Source/Blaster/Pickups/JumpPickup.h @@ -0,0 +1,34 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Pickup.h" +#include "JumpPickup.generated.h" + +/** + * + */ +UCLASS() +class BLASTER_API AJumpPickup : public APickup +{ + GENERATED_BODY() + +protected: + virtual void OnSphereOverlap( + UPrimitiveComponent* OverlappedComponent, + AActor* OtherActor, + UPrimitiveComponent* OtherComp, + int32 OtherBodyIndex, + bool bFromSweep, + const FHitResult& SweepResult + ) override; + +private: + + UPROPERTY(EditAnywhere) + float JumpZVelocity = 2500.f; + + UPROPERTY(EditAnywhere) + float JumpBuffTime = 10.f; +};