LEAP Documentation 40220
Documentation for the LEAP project
WeaponInstanceVehicle.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4#include "CoreMinimal.h"
6#include "WeaponInstanceVehicle.generated.h"
7
9class UVehicleWeaponSeatComponent;
10
14UCLASS()
16{
17 GENERATED_UCLASS_BODY()
18public:
19 virtual bool IsLocallyOwnedRemote() const override;
20 virtual bool IsLocallyOwned() const override;
21 virtual bool IsSimulatedOnly() const override;
22 virtual bool IsAuthority() const override;
23 virtual bool IsNonOwningAuthority() const override;
24 virtual AProjectXPlayerController* GetOwningPlayerController() const override;
25 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
26 virtual void InitializeWeapon(bool bFromBatchInitialization = false) override;
27 virtual bool Equip() override;
28 virtual bool UnEquip(bool bForce=false) override;
29 virtual bool GetProjectileTransform_Implementation(FTransform& Transform, FTransform& CosmeticTransform) override;
30 virtual bool CanFire(EWeaponError& ErrorMessage, uint8 Mode = 0) const override;
31 UFUNCTION(BlueprintCallable, Category = Weapon)
32 AProjectXVehicle* GetVehicle() const;
33 UFUNCTION(BlueprintCallable, Category = Weapon)
34 UVehicleSeatComponent* GetSeat() const;
35 UFUNCTION()
36 bool ShouldProcessViewRotation() const;
37 void SetSeatOwner(UVehicleSeatComponent* NewSeatOwner);
38 void ProcessViewRotation();
39 void UpdateRotation(FRotator& Rotation, FRotator& DeltaRotation, float DeltaTime);
40 void GetInterpolatedRotation(FRotator& Rotation, const FRotator& Target, float DeltaTime);
41 void ClampRotation(FRotator& Rotation);
42
43 virtual void PlayWeaponFireEffects(uint8 BurstCounter = 0);
44
45protected:
46 virtual void ProcessViewRotation(float DeltaTime, FRotator& OutViewRotation, FRotator& OutDeltaRot, bool& bUseDefaultProcess);
47 virtual TArray<AActor*> GetIgnoredActors() override;
48
49 UPROPERTY(Replicated)
50 AProjectXVehicle* VehicleOwner = NULL;
51 UPROPERTY(Replicated)
52 UVehicleSeatComponent* SeatOwner = NULL;
53 /*lock the rotation of the weapon*/
54 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon")
55 bool bLockRotation = false;
56
57 /* clamp the rotation around the z axis*/
58 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon", meta = (EditCondition="bLockRotation"))
59 float YawClamp = -1.f;
60 /* clamp the rotation updwards around the x axis*/
61 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon", meta = (EditCondition="bLockRotation"))
62 float PitchClampUp = -1.f;
63 /* clamp the rotation downawards around the x axis*/
64 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon", meta = (EditCondition = "bLockRotation"))
65 float PitchClampDown = -1.f;
66 /* use the rotation rate*/
67 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon")
68 bool bRotationToRate = false;
69 /* Smooth the rotation rate*/
70 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon")
71 bool bUseSmoothRotation = true;
72 /* rate at which the player can change rotation*/
73 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon", meta = (EditCondition="bRotationToRate"))
74 float RotationRate = -1.f;
75 /* Speed at which we smoothly interpolate when the rotation is not constant*/
76 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon", meta = (EditCondition = "bRotationToRate && bUseSmoothRotation"))
77 float SmoothRotationRate = 7.0f;
78 /* If the dot between the target rotation and the current rotations forward vectors is smaller than this, we'll use the smooth rotation approach to smooth out choppy rotation updates */
79 UPROPERTY(EditDefaultsOnly, Category = "Vehicle Weapon", meta = (EditCondition = "bRotationToRate && bUseSmoothRotation"))
80 float SmoothThresholdDot = 0.95f;
81
82 UPROPERTY()
83 FRotator RelativeRotation = FRotator(ForceInit);
84 UPROPERTY()
85 float PitchRotationRate = 0.f;
86 UPROPERTY()
87 float YawRotationRate = 0.f;
88
89 FDelegateHandle ViewUpdateHandle;
90};
EWeaponError
Definition: WeaponComponent.h:15
Definition: ProjectXPlayerController.h:83
Definition: ProjectXVehicle.h:56
Definition: WeaponInstanceProjectile.h:36
Definition: WeaponInstanceVehicle.h:16