blaster/Source/Blaster/Weapon/Weapon.h

71 lines
1.8 KiB
C
Raw Normal View History

2022-04-29 22:26:35 +00:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Weapon.generated.h"
UENUM(BlueprintType)
enum class EWeaponState : uint8
{
EWS_Initial UMETA(DisplayName = "Initial State"),
EWS_Equipped UMETA(DisplayName = "Equipped"),
EWS_Dropped UMETA(DisplayName = "Dropped"),
2022-04-30 11:09:28 +00:00
2022-04-29 22:26:35 +00:00
EWS_MAX UMETA(DisplayName = "DefaultMAX")
};
UCLASS()
class BLASTER_API AWeapon : public AActor
{
GENERATED_BODY()
2022-04-29 23:19:55 +00:00
public:
2022-04-29 22:26:35 +00:00
AWeapon();
2022-04-30 14:08:00 +00:00
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
2022-04-30 10:26:25 +00:00
void ShowPickupWidget(bool bShowWidget);
2022-04-29 22:26:35 +00:00
protected:
virtual void BeginPlay() override;
2022-04-29 23:19:55 +00:00
UFUNCTION()
virtual void OnSphereOverlap(
UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor,
UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex,
bool bFromSweep,
const FHitResult& SweepResult
);
2022-04-30 10:26:25 +00:00
UFUNCTION()
virtual void OnSphereEndOverlap(
UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor,
UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex
);
2022-04-29 23:19:55 +00:00
private:
2022-04-29 22:26:35 +00:00
UPROPERTY(VisibleAnywhere, Category="Weapon Properties")
USkeletalMeshComponent* WeaponMesh;
UPROPERTY(VisibleAnywhere, Category="Weapon Properties")
class USphereComponent* AreaSphere;
2022-04-30 14:08:00 +00:00
UPROPERTY(ReplicatedUsing = OnRep_WeaponState, VisibleAnywhere, Category="Weapon Properties")
2022-04-29 22:26:35 +00:00
EWeaponState WeaponState;
2022-04-30 14:08:00 +00:00
UFUNCTION()
void OnRep_WeaponState();
2022-04-29 23:19:55 +00:00
UPROPERTY(VisibleAnywhere, Category="Weapon Properties")
class UWidgetComponent* PickupWidget;
2022-04-29 22:26:35 +00:00
2022-04-29 23:19:55 +00:00
public:
2022-04-30 14:08:00 +00:00
void SetWeaponState(EWeaponState State);
FORCEINLINE USphereComponent* GetAreaSphere() const { return AreaSphere; }
2022-05-03 22:43:10 +00:00
FORCEINLINE USkeletalMeshComponent* GetWeaponMesh() const { return WeaponMesh; };
2022-04-29 22:26:35 +00:00
};