54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "NiagaraFunctionLibrary.h"
|
|
#include "Components/RadialSlider.h"
|
|
#include "HoldToInitCombat.generated.h"
|
|
|
|
class UNiagaraSystem;
|
|
|
|
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
|
class THE_TWILIGHT_ABYSS_API UHoldToInitCombat : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this component's properties
|
|
UHoldToInitCombat();
|
|
UPROPERTY()
|
|
UUserWidget* InitCombatWidget;
|
|
UPROPERTY()
|
|
TSubclassOf<UUserWidget> InitCombatWidgetClass;
|
|
|
|
UPROPERTY()
|
|
UNiagaraSystem* GunEffect;
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
float ReloadTime = 1.0f;
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void OnClickDown();
|
|
|
|
protected:
|
|
// Called when the game starts
|
|
virtual void BeginPlay() override;
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
|
private:
|
|
bool bClickDown = false;
|
|
float ReloadTimer = 0.0f;
|
|
|
|
UFUNCTION()
|
|
AActor* LookingAtEnemy() const;
|
|
AActor* TargetEnemy = nullptr;
|
|
|
|
UPROPERTY()
|
|
URadialSlider* ReloadSlider;
|
|
};
|