blaster/Source/Blaster/Components/BuffComponent.h

65 lines
1.6 KiB
C
Raw Normal View History

2022-05-22 21:17:42 +00:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "BuffComponent.generated.h"
2022-05-22 23:06:42 +00:00
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
2022-05-22 21:17:42 +00:00
class BLASTER_API UBuffComponent : public UActorComponent
{
GENERATED_BODY()
2022-05-22 23:06:42 +00:00
public:
2022-05-22 21:17:42 +00:00
UBuffComponent();
friend class ABlasterCharacter;
2022-05-22 22:16:27 +00:00
void Heal(float HealAmount, float HealingTime);
2022-05-23 10:35:20 +00:00
void ReplenishShield(float ShieldAmount, float ReplenishTime);
2022-05-22 23:06:42 +00:00
void BuffSpeed(float BuffBaseSpeed, float BuffCrouchSpeed, float BuffTime);
2022-05-22 23:53:02 +00:00
void BuffJump(float BuffJumpVelocity, float BuffTime);
2022-05-22 23:06:42 +00:00
void SetInitialSpeeds(float BaseSpeed, float CrouchSpeed);
2022-05-22 23:53:02 +00:00
void SetInitialJumpVelocity(float Velocity);
2022-05-22 21:17:42 +00:00
protected:
virtual void BeginPlay() override;
2022-05-22 22:16:27 +00:00
void HealRampUp(float DeltaTime);
2022-05-23 10:35:20 +00:00
void ShieldRampUp(float DeltaTime);
2022-05-22 21:17:42 +00:00
private:
UPROPERTY()
class ABlasterCharacter* Character;
2022-05-22 22:16:27 +00:00
2022-05-22 23:06:42 +00:00
// Heal Buff
2022-05-22 22:16:27 +00:00
bool bHealing = false;
float HealingRate = 0;
float AmountToHeal = 0.f;
2022-05-22 21:17:42 +00:00
2022-05-23 10:35:20 +00:00
// Shield Buff
bool bReplenishingShield = false;
float ShieldReplenishRate = 0;
float ShieldReplenishAmount = 0.f;
2022-05-22 23:06:42 +00:00
// Speed Buff
FTimerHandle SpeedBuffTimer;
void ResetSpeeds();
float InitialBaseSpeed;
float InitialCrouchSpeed;
UFUNCTION(NetMulticast, Reliable)
void MulticastSpeedBuff(float BaseSpeed, float CrouchSpeed);
2022-05-22 23:53:02 +00:00
// Jump Buff
FTimerHandle JumpBuffTimer;
void ResetJump();
float InitialJumpZVelocity;
UFUNCTION(NetMulticast, Reliable)
void MulticastJumpBuff(float JumpVelocity);
2022-05-22 23:06:42 +00:00
public:
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
2022-05-22 21:17:42 +00:00
};