Space Plunder
Loading...
Searching...
No Matches
WeaponPickupPad.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Components/CapsuleComponent.h"
8#include "GameFramework/Actor.h"
9#include "WeaponPickupPad.generated.h"
10
11
19UCLASS()
20class WEAPONSYSTEM_API AWeaponPickupPad : public AActor
21{
22 GENERATED_BODY()
23
24public:
26 virtual void OnConstruction(const FTransform& Transform) override;
27
28 virtual void Tick(float DeltaTime) override;
29
30 UFUNCTION()
31 void OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepHitResult);
32 //Check for pawns standing on pad when the weapon is spawned.
33 void CheckForExistingOverlaps();
34
35
36 UFUNCTION(BlueprintNativeEvent)
37 void AttemptPickUpWeapon(APawn* Pawn);
38
39
40 UFUNCTION()
41 void OnRep_WeaponAvailability();
42
43protected:
44 virtual void BeginPlay() override;
45
46 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Components")
47 TObjectPtr<UCapsuleComponent> CollisionVolume;
48 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Components")
49 USceneComponent* RootSceneComponent;
50 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Components")
51 TObjectPtr<UStaticMeshComponent> PadMesh;
52 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Components")
53 TObjectPtr<USkeletalMeshComponent> WeaponMesh;
54
55 //Data asset used to configure a Weapon Spawner
56 UPROPERTY(EditInstanceOnly, BlueprintReadOnly, Category = "WeaponPickup")
57 FWeaponData_T WeaponDefinition;
58
59 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, ReplicatedUsing = OnRep_WeaponAvailability, Category = "WeaponPickup")
60 bool bIsWeaponAvailable;
61 //The amount of time between weapon pickup and weapon spawning in seconds
62 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "WeaponPickup")
63 float CoolDownTime;
64 //Delay between when the weapon is made available and when we check for a pawn standing in the spawner. Used to give the bIsWeaponAvailable OnRep time to fire and play FX.
65 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "WeaponPickup")
66 float CheckExistingOverlapDelay;
67 //Used to drive weapon respawn time indicators 0-1
68 UPROPERTY(BlueprintReadOnly, Transient, Category = "WeaponPickup")
69 float CoolDownPercentage;
70
71 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "WeaponPickup")
72 float WeaponMeshRotationSpeed;
73
74 FTimerHandle CoolDownTimerHandle;
75 FTimerHandle CheckOverlapsDelayTimerHandle;
76
77 void StartCoolDown();
78
79 UFUNCTION(BlueprintCallable, Category = "Lyra|WeaponPickup")
80 void ResetCoolDown();
81
82 UFUNCTION()
83 void OnCoolDownTimerComplete();
84
85 void SetWeaponPickupVisibility(bool bShouldBeVisible);
86
87 UFUNCTION(BlueprintNativeEvent, Category = "Lyra|WeaponPickup")
88 void PlayPickupEffects();
89
90 UFUNCTION(BlueprintNativeEvent, Category = "Lyra|WeaponPickup")
91 void PlayRespawnEffects();
92
93
94};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
This class represents a weapon pickup pad in the game.
Definition WeaponPickupPad.h:21
Struct representing data of a weapon that changes.
Definition WeaponStructs.h:861