22. Init ability actor info
This commit is contained in:
parent
931edffc7c
commit
5a4fc6381b
Binary file not shown.
Binary file not shown.
@ -43,11 +43,31 @@ AGasaCharacter::AGasaCharacter()
|
||||
{
|
||||
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Minimal);
|
||||
|
||||
Attributes = CreateDefaultSubobject<UAttributeSet>("Attributes");
|
||||
}
|
||||
}
|
||||
|
||||
#pragma region Pawn
|
||||
void AGasaCharacter::PossessedBy(AController* NewController)
|
||||
{
|
||||
Super::PossessedBy(NewController);
|
||||
|
||||
if (bAutoAbilitySystem)
|
||||
{
|
||||
// TODO(Ed): Do we need to do this for enemies?
|
||||
AbilitySystem->InitAbilityActorInfo(this, this);
|
||||
}
|
||||
}
|
||||
|
||||
void AGasaCharacter::OnRep_PlayerState()
|
||||
{
|
||||
Super::OnRep_PlayerState();
|
||||
}
|
||||
#pragma endregion Pawn
|
||||
|
||||
#pragma region Actor
|
||||
void AGasaCharacter::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
@ -96,3 +116,4 @@ void AGasaCharacter::Tick(float DeltaSeconds)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma endregion Actor
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "Game/GasaPlayerState.h"
|
||||
|
||||
#include "GasaCharacter.generated.h"
|
||||
|
||||
@ -57,10 +58,18 @@ public:
|
||||
|
||||
AGasaCharacter();
|
||||
|
||||
FORCEINLINE AGasaPlayerState* GetGasaPlayerState() { return GetPlayerState<AGasaPlayerState>(); }
|
||||
|
||||
#pragma region IAbilitySystem
|
||||
FORCEINLINE UAttributeSet* GetAttributes() { return Attributes; }
|
||||
FORCEINLINE UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
|
||||
#pragma endregion IAbilitySystem
|
||||
|
||||
#pragma region Pawn
|
||||
void PossessedBy(AController* NewController) override;
|
||||
|
||||
void OnRep_PlayerState() override;
|
||||
#pragma endregion Pawn
|
||||
|
||||
#pragma region Actor
|
||||
void BeginPlay() override;
|
||||
|
@ -1,8 +1,23 @@
|
||||
#include "PlayerCharacter.h"
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
|
||||
APlayerCharacter::APlayerCharacter()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
bAutoAbilitySystem = false;
|
||||
}
|
||||
|
||||
void APlayerCharacter::OnRep_PlayerState()
|
||||
{
|
||||
Super::OnRep_PlayerState();
|
||||
|
||||
AGasaPlayerState* PS = GetGasaPlayerState();
|
||||
// Client setup ability system
|
||||
{
|
||||
AbilitySystem = PS->AbilitySystem;
|
||||
Attributes = PS->Attributes;
|
||||
AbilitySystem->InitAbilityActorInfo(PS, this);
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,9 @@ class GASA_API APlayerCharacter : public AGasaCharacter
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
APlayerCharacter();
|
||||
APlayerCharacter();
|
||||
|
||||
#pragma region Pawn
|
||||
void OnRep_PlayerState() override;
|
||||
#pragma endregion Pawn
|
||||
};
|
||||
|
@ -1,8 +1,10 @@
|
||||
#include "GasaPlayerController.h"
|
||||
|
||||
#include "AbilitySystemComponent.h"
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "GasaPlayerState.h"
|
||||
#include "Actors/CameraMount.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Characters/GasaCharacter.h"
|
||||
@ -67,6 +69,15 @@ void AGasaPlayerController::OnPossess(APawn* InPawn)
|
||||
Super::OnPossess(InPawn);
|
||||
|
||||
Cam->AttachToActor(InPawn, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
|
||||
AGasaPlayerState* PS = GetPlayerState();
|
||||
AGasaCharacter* character = Cast<AGasaCharacter>(InPawn);
|
||||
// Net Owner setup ability system
|
||||
{
|
||||
character->AbilitySystem = PS->AbilitySystem;
|
||||
character->Attributes = PS->Attributes;
|
||||
character->AbilitySystem->InitAbilityActorInfo(PS, character);
|
||||
}
|
||||
}
|
||||
|
||||
void AGasaPlayerController::OnUnPossess()
|
||||
|
@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "GasaPlayerState.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
|
||||
#include "GasaPlayerController.generated.h"
|
||||
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class GASA_API AGasaPlayerController : public APlayerController
|
||||
{
|
||||
@ -48,11 +48,16 @@ public:
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Input")
|
||||
TObjectPtr<UInputAction> IA_Move;
|
||||
|
||||
void Move(FInputActionValue const& ActionValue);
|
||||
#pragma endregion Input
|
||||
|
||||
AGasaPlayerController();
|
||||
|
||||
void Move(FInputActionValue const& ActionValue);
|
||||
AGasaPlayerState* GetPlayerState()
|
||||
{
|
||||
return Cast<AGasaPlayerState>( PlayerState );
|
||||
}
|
||||
|
||||
#pragma region PlayerController
|
||||
void OnPossess(APawn* InPawn) override;
|
||||
|
@ -6,6 +6,7 @@ AGasaPlayerState::AGasaPlayerState()
|
||||
{
|
||||
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
|
||||
|
||||
Attributes = CreateDefaultSubobject<UAttributeSet>("Attributes");
|
||||
|
||||
|
@ -31,4 +31,8 @@ public:
|
||||
FORCEINLINE UAttributeSet* GetAttributes() { return Attributes; }
|
||||
FORCEINLINE UAbilitySystemComponent* GetAbilitySystemComponent() const override { return AbilitySystem; }
|
||||
#pragma endregion IAbilitySystem
|
||||
|
||||
#pragma region
|
||||
|
||||
#pragma endregion
|
||||
};
|
||||
|
@ -8,6 +8,10 @@
|
||||
#define internal static
|
||||
#define local_persist static
|
||||
|
||||
#pragma region Math
|
||||
#define m_pow2( value ) (value * value)
|
||||
#pragma endregion Math
|
||||
|
||||
#pragma region Engine Forwards
|
||||
struct FInputActionValue;
|
||||
|
||||
@ -130,3 +134,22 @@ namespace Gasa
|
||||
#define GASA_Verbose(Message) UE_LOG( Gasa, Verbose, TEXT("%s -- %hs %hs(%d)"), *Message, __builtin_File(), __func__, __builtin_LINE() );
|
||||
#define GASA_VeryVerbose(Message) UE_LOG( Gasa, VeryVerbose, TEXT("%s -- %hs %hs(%d)"), *Message, __builtin_File(), __func__, __builtin_LINE() );
|
||||
#pragma endregion Logging
|
||||
|
||||
#pragma region Timing
|
||||
namespace Gasa
|
||||
{
|
||||
constexpr float _24Hz = .042f;
|
||||
constexpr float _30Hz = .033f;
|
||||
constexpr float _42Hz = .024f;
|
||||
constexpr float _45Hz = .022f;
|
||||
constexpr float _50Hz = .020f;
|
||||
constexpr float _60Hz = .016f;
|
||||
constexpr float _72Hz = .014f;
|
||||
constexpr float _80Hz = .013f;
|
||||
constexpr float _90Hz = .011f;
|
||||
constexpr float _100Hz = .010f;
|
||||
constexpr float _120Hz = .083f;
|
||||
constexpr float _240Hz = .004f;
|
||||
constexpr float _480Hz = .002f;
|
||||
}
|
||||
#pragma endregion Timing
|
@ -86,5 +86,5 @@ float UGasaLib::printToScreenDuration = 10.0f;
|
||||
#pragma region Timing
|
||||
// Protected
|
||||
|
||||
float UGasaLib::timingRate_Std = UGasaLib::_60Hz;
|
||||
float UGasaLib::timingRate_Std = Gasa::_60Hz;
|
||||
#pragma endregion Timing
|
||||
|
@ -45,65 +45,51 @@ public:
|
||||
#pragma region Timing
|
||||
public:
|
||||
|
||||
static constexpr float _24Hz = .042f;
|
||||
static constexpr float _30Hz = .033f;
|
||||
static constexpr float _42Hz = .024f;
|
||||
static constexpr float _45Hz = .022f;
|
||||
static constexpr float _50Hz = .020f;
|
||||
static constexpr float _60Hz = .016f;
|
||||
static constexpr float _72Hz = .014f;
|
||||
static constexpr float _80Hz = .013f;
|
||||
static constexpr float _90Hz = .011f;
|
||||
static constexpr float _100Hz = .010f;
|
||||
static constexpr float _120Hz = .083f;
|
||||
static constexpr float _240Hz = .004f;
|
||||
static constexpr float _480Hz = .002f;
|
||||
|
||||
// Constant Rates
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "24 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_24Hz () { return _24Hz; }
|
||||
static FORCEINLINE float BP_Clock_24Hz () { return Gasa::_24Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "30 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_30Hz () { return _30Hz; }
|
||||
static FORCEINLINE float BP_Clock_30Hz () { return Gasa::_30Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "42 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_42Hz () { return _42Hz; }
|
||||
static FORCEINLINE float BP_Clock_42Hz () { return Gasa::_42Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "50 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_50Hz () { return _50Hz; }
|
||||
static FORCEINLINE float BP_Clock_50Hz () { return Gasa::_50Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "60 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_60Hz () { return _60Hz; }
|
||||
static FORCEINLINE float BP_Clock_60Hz () { return Gasa::_60Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "72 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_72Hz () { return _72Hz; }
|
||||
static FORCEINLINE float BP_Clock_72Hz () { return Gasa::_72Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "80 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_80Hz () { return _80Hz; }
|
||||
static FORCEINLINE float BP_Clock_80Hz () { return Gasa::_80Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "90 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_90Hz () { return _90Hz; }
|
||||
static FORCEINLINE float BP_Clock_90Hz () { return Gasa::_90Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "100 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_100Hz() { return _100Hz; }
|
||||
static FORCEINLINE float BP_Clock_100Hz() { return Gasa::_100Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "120 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_120Hz() { return _120Hz; }
|
||||
static FORCEINLINE float BP_Clock_120Hz() { return Gasa::_120Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "240 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BP_Clock_240Hz() { return _240Hz; }
|
||||
static FORCEINLINE float BP_Clock_240Hz() { return Gasa::_240Hz; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "480 Hz", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float BPClock_480Hz() { return _480Hz; }
|
||||
static FORCEINLINE float BPClock_480Hz() { return Gasa::_480Hz; }
|
||||
|
||||
// Standard Timing
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "Time Rate", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float GetStd_Timerate () { return timingRate_Std; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "Quarter Time Rate", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float GetStd_Timerate_Quarter() { return timingRate_Std / 4.0f; }
|
||||
static FORCEINLINE float GetStd_Timerate_Quarter() { return timingRate_Std * 0.25f; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "Half Time Rate", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float GetStd_Timerate_Half () { return timingRate_Std / 2.0f; }
|
||||
static FORCEINLINE float GetStd_Timerate_Half () { return timingRate_Std * 0.5f; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "2X Time Rate", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float GetStd_Timerate_2X () { return timingRate_Std * 2.0f; }
|
||||
UFUNCTION(BlueprintPure, Category = "Timing", Meta = (DisplayName = "4X Time Rate", CallableWithoutWorldContext))
|
||||
static FORCEINLINE float GetStd_Timerate_4X () { return timingRate_Std * 2.0f; }
|
||||
static FORCEINLINE float GetStd_Timerate_4X () { return timingRate_Std * 4.0f; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Timing", Meta = (DisplayName = "Set Time Rate"))
|
||||
static void SetStd_Timerate(float _rateDesired)
|
||||
{
|
||||
// Not the best check.. if inconsistency arises, use the a rigorous one.
|
||||
if (_rateDesired >= _24Hz)
|
||||
if (_rateDesired >= Gasa::_24Hz)
|
||||
{
|
||||
timingRate_Std = _rateDesired;
|
||||
}
|
||||
|
2
Project/Source/Gasa/Networking/GasaNetLibrary.cpp
Normal file
2
Project/Source/Gasa/Networking/GasaNetLibrary.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "GasaNetLibrary.h"
|
||||
|
15
Project/Source/Gasa/Networking/GasaNetLibrary.h
Normal file
15
Project/Source/Gasa/Networking/GasaNetLibrary.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace Gasa
|
||||
{
|
||||
constexpr float NetCullDist_Default = 225000000.0f;
|
||||
constexpr float NetCullDist_Immediate = 250.0f * 250.0f;
|
||||
constexpr float NetCullDist_VerClose = 1000.0f * 1000.0f;
|
||||
constexpr float NetCullDist_Close = 3500.0f * 3500.0f;
|
||||
constexpr float NetCullDist_Medium = 5000.0f * 5000.0f;
|
||||
constexpr float NetCullDist_Distant = 7000.0f * 7000.0f;
|
||||
constexpr float NetCullDist_Far = 8500.0f * 8500.0f;
|
||||
constexpr float NetCullDist_VeryFar = 10000.0f * 10000.0f;
|
||||
constexpr float NetCullDist_VisualMax = 15000.0f * 15000.0f;
|
||||
}
|
Loading…
Reference in New Issue
Block a user