5#include "CoreMinimal.h"
6#include "Components/ActorComponent.h"
8#include "VehicleSeatComponent.generated.h"
13class UAfflictionInstance;
17UCLASS(Blueprintable, ClassGroup = (
Custom), HideCategories = (ComponentTick, Collision, Tags, Variable, Activation, ComponentReplication, Cooking), meta = (BlueprintSpawnableComponent))
18class PROJECTX_API UVehicleSeatComponent :
public UActorComponent
20 GENERATED_UCLASS_BODY()
24 UFUNCTION(BlueprintCallable, Category = Seat)
25 FORCEINLINE
bool IsDriverSeat()
const {
return bDriverSeat; }
26 UFUNCTION(BlueprintCallable, Category = Seat)
27 FORCEINLINE FName GetSeatName()
const {
return SeatName; }
28 FORCEINLINE
void SetSeatName(
const FName NewName) { SeatName = NewName; }
29 UFUNCTION(BlueprintCallable, Category = Seat)
31 UFUNCTION(BlueprintCallable, Category = Seat)
33 UFUNCTION(BlueprintCallable, Category = Seat)
35 UFUNCTION(Category = Seat)
36 bool GetUseCharacterBoundsWhenVisible()
const {
return bUseCharacterMeshBoundsWhenVisible;}
37 UFUNCTION(BlueprintCallable, Category = Seat)
38 FORCEINLINE
bool ShouldOccupantBeHidden()
const {
return bHideOccupant; }
39 UFUNCTION(BlueprintCallable, Category = Seat)
40 void ToggleSeatAttachment(
const bool bNewToggle) {bIsAttachedToSeat = bNewToggle;}
41 UFUNCTION(BlueprintCallable, Category = Seat)
42 void SetManualSeatOffset(
const FVector NewOffset) { CurrentSeatOffset = NewOffset; }
43 UFUNCTION(BlueprintCallable, Category = Seat)
44 void ResetSeatOffset() { CurrentSeatOffset = SeatOffset; }
45 UFUNCTION(BlueprintCallable, Category = Seat)
46 virtual FTransform GetSeatTransform()
const;
47 UFUNCTION(BlueprintCallable, Category = Seat)
48 virtual FVector GetSeatLocation()
const;
49 UFUNCTION(BlueprintCallable, Category = Seat)
50 virtual FRotator GetSeatRotation()
const;
51 UFUNCTION(BlueprintCallable, Category = Seat)
52 virtual FRotator GetLookDirection()
const;
54 UFUNCTION(BlueprintCallable, Category = Seat)
55 virtual FTransform GetExitTransform()
const;
57 UFUNCTION(BlueprintCallable, Category = Seat)
59 UFUNCTION(BlueprintCallable, Category = Seat)
60 virtual bool HasOccupant()
const;
63 virtual void BeginPlay()
override;
64 virtual void TickComponent(
float DeltaTime,
enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
override;
67 virtual
void TickOccupant(
float DeltaTime);
72 virtual
bool LeaveSeat(
bool bForced = false,
bool bEject = false);
75 virtual
void TickWeapon(
float DeltaTime);
77 UFUNCTION(BlueprintCallable, Category = Seat)
78 virtual UWeaponComponent* GetWeaponComponent() const;
80 bool GetProjectileTransform(FTransform& Transform);
83 UPROPERTY(BlueprintAssignable, Category = Seat)
84 FOccupantChangedSignature OnOccupantChangedSignature;
88 virtual
void OnRep_Occupant();
100 UPROPERTY(ReplicatedUsing = OnRep_Occupant)
105 UPROPERTY(EditDefaultsOnly, Category = Seat)
106 bool bDriverSeat = false;
109 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Seat, meta = (AllowPrivateAccess = true))
110 FName SeatName = NAME_None;
111 UPROPERTY(EditDefaultsOnly, Category = Seat)
112 FName SeatSocket = NAME_None;
114 UPROPERTY(EditDefaultsOnly, Category = Seat)
115 bool bUseSocketFromParentVehicle = false;
116 UPROPERTY(EditDefaultsOnly, Category = Seat)
117 FVector SeatOffset = FVector(0);
118 UPROPERTY(EditDefaultsOnly, Category = Seat)
119 FRotator SeatRotation = FRotator(0);
121 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Seat|Animation|Third Person")
122 TSubclassOf<UAnimInstance> AnimationClass3P;
124 UPROPERTY(EditDefaultsOnly, Category = Seat)
125 bool bUseEnterLocationAsExitLocation = true;
127 UPROPERTY(EditDefaultsOnly, Category = Seat)
128 FVector ExitOffset = FVector(0, 0, 160);
130 UPROPERTY(EditDefaultsOnly, Category = Seat)
131 FVector EjectLaunchVelocity = FVector::ZeroVector;
133 UPROPERTY(EditDefaultsOnly, Category = Seat)
134 float LaunchVelocityExchangeRate = 1.0f;
136 UPROPERTY(EditDefaultsOnly, Category = Seat)
139 UPROPERTY(EditDefaultsOnly, Category = Seat)
140 FName ProjectileSocket = NAME_None;
142 UPROPERTY(EditDefaultsOnly, Category = Seat)
143 FName MeshRotationSocket = NAME_None;
145 UPROPERTY(EditDefaultsOnly, Category = Seat)
146 bool bHideOccupant = false;
148 UPROPERTY(EditDefaultsOnly, Category = Seat , meta = (EditCondition = "!bHideOccupant"))
149 bool bUseCharacterMeshBoundsWhenVisible = false;
151 UPROPERTY(EditDefaultsOnly, Category = Seat)
152 TArray<TSubclassOf<UAfflictionInstance>> InvalidSeatAfflictions;
154 UPROPERTY(EditDefaultsOnly, Category = Seat)
155 TArray<TSubclassOf<UAfflictionInstance>> SeatOccupantAfflictions;
157 bool bOnlyTickWhenOccupied = true;
160 bool bIsAttachedToSeat = true;
161 float OccupantEntranceTime;
162 FVector CurrentSeatOffset = FVector::ZeroVector;
163 FVector CachedRelativeEntryLocation = FVector::ZeroVector;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOccupantChangedSignature, class UVehicleSeatComponent *, Seat, class AProjectXCharacter *, PreviousOccupant)
Definition: ProjectXCharacter.h:128
Definition: ProjectXVehicle.h:56
Definition: WeaponInstanceVehicle.h:16