OLS/Source/ols/Public/ModularGameplayActors/OLSModularPlayerStateCharacter.h

74 lines
3.2 KiB
C++

// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemComponent.h"
#include "AbilitySystemInterface.h"
#include "GameplayTagAssetInterface.h"
#include "GameFramework/Character.h"
#include "OLSModularPlayerStateCharacter.generated.h"
/**
* Minimal class that supports extension by game feature plugins.
*
* Intended to be used for ACharacters using AbilitySystemComponent living on PlayerState.
*/
UCLASS(Blueprintable)
class OLS_API AOLSModularPlayerStateCharacter : public ACharacter, public IAbilitySystemInterface, public IGameplayTagAssetInterface
{
GENERATED_BODY()
public:
AOLSModularPlayerStateCharacter(const FObjectInitializer& objectInitializer);
// -- Begin Actor implementation
virtual void PreInitializeComponents() override;
virtual void BeginPlay() override;
virtual void EndPlay(const EEndPlayReason::Type endPlayReason) override;
virtual void PostInitProperties() override;
// -- End Actor implementation
// -- Begin APawn implementation
virtual void PossessedBy(AController* newController) override;
virtual void OnRep_PlayerState() override;
// -- End APawn implementation
// -- Begin IAbilitySystemInterface implementation
virtual class UAbilitySystemComponent* GetAbilitySystemComponent() const override;
// -- End IAbilitySystemInterface implementation
// -- Begin IGameplayTagAssetInterface
virtual void GetOwnedGameplayTags(FGameplayTagContainer& outTagContainer) const override;
virtual bool HasMatchingGameplayTag(FGameplayTag tagToCheck) const override;
virtual bool HasAllMatchingGameplayTags(const FGameplayTagContainer& tagContainer) const override;
virtual bool HasAnyMatchingGameplayTags(const FGameplayTagContainer& tagContainer) const override;
// -- End IGameplayTagAssetInterface
protected:
/**
* Ability System Replication Mode: How gameplay effects will be replicated to clients
*
* - Full: Replicate full gameplay info to all. Every GameplayEffect is replicated to every client.
* (Recommended for Single Player games)
* - Mixed: Only replicate minimal gameplay effect info to simulated proxies but full info to owners and autonomous proxies.
* GameplayEffects are only replicated to the owning client. Only GameplayTags and GameplayCues are replicated to everyone.
* (Recommended for Multiplayer on Player controlled Actors)
* - Minimal: Only replicate minimal gameplay effect info. Note: this does not work for Owned AbilitySystemComponents (Use Mixed instead).
* GameplayEffects are never replicated to anyone. Only GameplayTags and GameplayCues are replicated to everyone.
* (Recommended for Multiplayer on AI controlled Actors)
*
* @See https://github.com/tranek/GASDocumentation#concepts-asc-rm for more information
*/
UPROPERTY(EditDefaultsOnly, Category = "OLS Ability System")
EGameplayEffectReplicationMode ReplicationMode;
protected:
// Cached AbilitySystemComponent. Real owner is PlayerState, but pointer gets updated to use PlayerState's here in PossessedBy / OnRep_PlayerState
TWeakObjectPtr<UAbilitySystemComponent> AbilitySystemComponent;
};