Space Plunder
Loading...
Searching...
No Matches
HitscanWeaponComponent.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/ActorComponent.h"
8#include "HitscanWeaponComponent.generated.h"
9
10DECLARE_LOG_CATEGORY_EXTERN(LogWeaponHitScan, Display, All);
11
12
13UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
14class WEAPONSYSTEM_API UHitscanWeaponComponent : public UActorComponent
15{
16 GENERATED_BODY()
17
18public:
19 UHitscanWeaponComponent();
20
21 virtual FHitResult ServerShoot(const float Accuracy, const FVector& MuzzleLocation, const float GunRange, const FVector& BulletSpread, const FVector& TraceLocation, const FRotator& TraceRotation);
22 virtual bool ServerShoot_Validate();
23
24 virtual void SetMuzzle(USceneComponent* Muzzle){MuzzlePoint = Muzzle;};
25
26 bool GetIsTraceToClose(const FVector& MuzzleLocation, const FVector& HitLocation, const FRotator& TraceRotation) const;
27
28 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon|Hit Scan|Debugging")
29 bool bDebuggingMode = false;
30 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon|Hit Scan|Debugging")
31 float DrawDebugTime = 2.0f;
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon|Hit Scan|Debugging")
33 float DrawDebugColorDarkMultiplier = 0.1f;
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon|Hit Scan|Debugging")
35 float DrawDebugColorLightMultiplier = 2.0f;
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon|Hit Scan|Debugging")
37 float DrawDebugPointSize = 16.0f;
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon|Hit Scan|Debugging")
39 FLinearColor MainTraceColor = FLinearColor(0.9f, 0.1f, 0.1f);
40 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon|Hit Scan|Debugging")
41 FLinearColor BlindFireTraceColor = FLinearColor(0.1f, 0.9f, 0.1f);
42
43 UPROPERTY(EditAnywhere, Category = "Weapon|Hit Scan|Trace")
44 bool bTraceComplex = false;
45 UPROPERTY(EditAnywhere, Category = "Weapon|Hit Scan|Trace")
46 bool bReturnPhysicalMaterial = false;
47 UPROPERTY(EditAnywhere, Category = "Weapon|Hit Scan|Trace")
48 float TraceDistanceTooClose = 0.075f;
49
50protected:
51 virtual void BeginPlay() override;
52
53 virtual bool LineTrace(const float GunRange, const FVector& BulletSpread, const FVector& TraceLocation, const FRotator& TraceRotation, FHitResult& Hit, FVector& ShotDirection, const FLinearColor& Color = FLinearColor::Green, const FVector& CustomLineEnd = FVector::ZeroVector) const;
54 virtual FHitResult BlindFireWeaponTrace(const float GunRange, const FVector& BulletSpread, const FVector& TraceLocation,
55 const FRotator& TraceRotation, const float Accuracy, const AActor* ActorToIgnore = nullptr);
56
57 virtual float CalculateDistanceDamage(const FWeaponStats_T& WeaponStats, const float Distance) const;
58
59private:
60 void LogDebugMessage(const FString& Message, const bool bError = false) const;
61
62 UPROPERTY()
63 const USceneComponent* MuzzlePoint = nullptr;
64
65 UPROPERTY()
66 const AActor* TraceActorToIgnore = nullptr;
67 UPROPERTY()
68 TArray<AActor*> ActorsToIgnore;
69
70
71};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
DECLARE_LOG_CATEGORY_EXTERN(LogWeaponHitScan, Display, All)
Represents statistics for a weapon.
Definition WeaponStructs.h:622