Nelaric Unreal Gameplay
Gameplay framework API
Toggle main menu visibility
Loading...
Searching...
No Matches
NelaricPawnComponent.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Nelaric
2
6
7
#pragma once
8
9
#include "Components/ActorComponent.h"
10
#include "Templates/UnrealTypeTraits.h"
11
#include "Templates/Casts.h"
12
13
#include "NelaricPawnComponent.generated.h"
14
15
class
AController;
16
class
APawn;
17
class
APlayerController;
18
class
APlayerState;
19
29
UCLASS(Abstract, MinimalAPI, Blueprintable)
30
class UNelaricPawnComponent : public UActorComponent
31
{
32
GENERATED_BODY()
33
34
public
:
41
UFUNCTION(BlueprintPure, Category =
"Nelaric|Pawn"
)
42
GAMEPLAYRUNTIME_API APawn*
GetPawn
() const;
43
50
template <typename T> T*
GetPawn
()
const
51
{
52
static_assert
(TIsDerivedFrom<T, APawn>::IsDerived,
"T must derive from APawn."
);
53
return
Cast<T>(
GetPawn
());
54
}
55
62
UFUNCTION(BlueprintPure, Category =
"Nelaric|Pawn"
)
63
GAMEPLAYRUNTIME_API AController*
GetController
() const;
64
71
template <typename T> T*
GetController
()
const
72
{
73
static_assert
(TIsDerivedFrom<T, AController>::IsDerived,
"T must derive from AController."
);
74
return
Cast<T>(
GetController
());
75
}
76
83
UFUNCTION(BlueprintPure, Category =
"Nelaric|Pawn"
)
84
GAMEPLAYRUNTIME_API APlayerController*
GetPlayerController
() const;
85
92
template <typename T> T*
GetPlayerController
()
const
93
{
94
static_assert
(TIsDerivedFrom<T, APlayerController>::IsDerived,
"T must derive from APlayerController."
);
95
return
Cast<T>(
GetPlayerController
());
96
}
97
104
UFUNCTION(BlueprintPure, Category =
"Nelaric|Pawn"
)
105
GAMEPLAYRUNTIME_API APlayerState*
GetPlayerState
() const;
106
113
template <typename T> T*
GetPlayerState
()
const
114
{
115
static_assert
(TIsDerivedFrom<T, APlayerState>::IsDerived,
"T must derive from APlayerState."
);
116
return
Cast<T>(
GetPlayerState
());
117
}
118
124
UFUNCTION(BlueprintPure, Category =
"Nelaric|Pawn"
)
125
GAMEPLAYRUNTIME_API
bool
IsLocallyControlled
() const;
126
133
UFUNCTION(BlueprintPure, Category =
"Nelaric|Pawn"
)
134
GAMEPLAYRUNTIME_API
bool
IsPlayerControlled
() const;
135
136
public:
137
GAMEPLAYRUNTIME_API UNelaricPawnComponent(const FObjectInitializer& ObjectInitializer);
138
GAMEPLAYRUNTIME_API virtual
void
OnRegister() override;
139
};
UNelaricPawnComponent::GetPlayerState
GAMEPLAYRUNTIME_API APlayerState * GetPlayerState() const
Gets player state directly from the owning pawn.
UNelaricPawnComponent::IsPlayerControlled
GAMEPLAYRUNTIME_API bool IsPlayerControlled() const
Queries the pawn's native player-control semantics.
UNelaricPawnComponent::GetController
GAMEPLAYRUNTIME_API AController * GetController() const
Gets the pawn's current controller on this machine.
UNelaricPawnComponent::GetPlayerController
GAMEPLAYRUNTIME_API APlayerController * GetPlayerController() const
Gets the current controller when it is a player controller.
UNelaricPawnComponent::IsLocallyControlled
GAMEPLAYRUNTIME_API bool IsLocallyControlled() const
Queries the pawn's native local-control semantics.
UNelaricPawnComponent::GetPawn
GAMEPLAYRUNTIME_API APawn * GetPawn() const
Gets the pawn that directly owns this component.
NelaricGameplay
Plugins
NelaricGameplay
Source
GameplayRuntime
Public
Pawn
NelaricPawnComponent.h
Generated by
1.18.0