document.write("
// Fill out your copyright notice in the Description page of Project Settings.
#include "DandelionPlayerState.h"
#include "AbilitySystemComponent.h"
#include "Dandelion/Sandbox/Abilities/DandelionAbilitySet.h"
#include "Dandelion/Sandbox/Pawns/DandelionPlayerCharacter.h"
#include "Dandelion/Sandbox/PlayerControllers/DandelionPlayerController.h"
ADandelionPlayerState::ADandelionPlayerState()
{
AbilitySystemComponent = CreateDefaultSubobject<UAbilitySystemComponent>("AbilitySystemComponent");
}
UAbilitySystemComponent* ADandelionPlayerState::GetAbilitySystemComponent() const { return AbilitySystemComponent; }
void ADandelionPlayerState::InitAbilitySystem() const
{
const ADandelionPlayerCharacter* DandelionPlayerCharacter = CastChecked<ADandelionPlayerCharacter>(GetPawn());
if (!ensure(IsValid(DandelionPlayerCharacter)))
{
UE_LOG(
LogTemplateCharacter,
Error,
TEXT("%s: Attempted InitAbilitySystem without a valid ADandelionPlayerCharacter."),
*GetFullNameSafe(this)
)
return;
}
for (const UDandelionAbilitySet* GameplayAbilitySet : DefaultGameplayAbilitySets)
{
GameplayAbilitySet->GiveAbilities(
AbilitySystemComponent,
DandelionPlayerCharacter->GetInputActionGameplayAbilityMappings()
);
}
}
DandelionPlayerState.cpp - Snippet hosted by \"Cacher\"
");