// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "Components/ActorComponent.h" #include #include #include "Interfaces/Damageable.h" #include "ShootingComponent.generated.h" UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) class EXO_API UShootingComponent : public UActorComponent { GENERATED_BODY() public: // Sets default values for this component's properties UShootingComponent(); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Debug") bool bShowDebugLine = true; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character") TObjectPtr PlayerCharacter; protected: // Called when the game starts virtual void BeginPlay() override; public: // Called every frame virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; UFUNCTION(Category = "Shooting") void Shoot(); UFUNCTION(Category = "Mele Attack") void MeleAttack(); UFUNCTION(Category = "Shooting") void Reload(); UFUNCTION(BlueprintCallable, Category = "Shooting") void PickUpGun(AGunBase* gunItem); UFUNCTION(Category = "Shooting") void DropGun(); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Shooting") float DropGunRange = 20.0f; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Mele Attack") float MeleRange = 75.f; private: void ResetFireCooldown(); void ReloadCompleted(); FTimerHandle ShootCooldownTimer; FTimerHandle ReloadTimer; bool bIsHoldingGun = false; TSubclassOf HoldingGunClass; bool bCanShoot = true; bool bIsReloading = false; float MaxRange = 2000.0f; float FireDamageValue = 100.0f; float MeleDamageValue = 50.f; float FireRateCooldown = 1.0f; float RecoilForceMultiplier = 1.0f; float ReloadTime = 3.0f; int32 CurrentAmmo = 10; int32 MaxAmmo = 10; };