Implemented AMyVICharacter

This commit is contained in:
Rafal Swierczek 2024-01-11 03:30:17 +00:00
parent 70db6b3a99
commit f8a86846b2
2 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,49 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyVICharacter.h"
#include "GAS/VIAbilitySystemComponent.h"
#include "Pawn/VIPawnVaultComponent.h"
#include "MotionWarpingComponent.h"
AMyVICharacter::AMyVICharacter(const FObjectInitializer& OI)
: Super(OI)
{
VaultComponent = CreateDefaultSubobject<UVIPawnVaultComponent>(TEXT("PawnVaulting"));
MotionWarpingComponent = CreateDefaultSubobject<UMotionWarpingComponent>(TEXT("MotionWarping"));
}
void AMyVICharacter::BeginPlay()
{
Super::BeginPlay();
// Init simulated proxy
if (AbilitySystem && GetLocalRole() == ROLE_SimulatedProxy)
{
// Will never have a valid controller
AbilitySystem->InitAbilityActorInfo(this, this);
}
}
void AMyVICharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
// Init authority/standalone
if (AbilitySystem)
{
AbilitySystem->InitAbilityActorInfo(this, this);
}
}
void AMyVICharacter::OnRep_Controller()
{
Super::OnRep_Controller();
// Init local client
if (AbilitySystem)
{
AbilitySystem->InitAbilityActorInfo(this, this);
}
}

View File

@ -0,0 +1,35 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "MyVICharacterAbilityBase.h"
#include "MyVICharacter.generated.h"
/**
*
*/
UCLASS()
class ENDLESSVENDETTA_API AMyVICharacter : public AMyVICharacterAbilityBase
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, Category = Vault)
FVIAnimSet VaultAnimSet;
UPROPERTY(EditDefaultsOnly, Category = Vault)
FVITraceSettings VaultTraceSettings;
AMyVICharacter(const FObjectInitializer& OI);
virtual void BeginPlay() override;
virtual void PossessedBy(AController* NewController) override;
virtual void OnRep_Controller() override;
virtual UVIPawnVaultComponent* GetPawnVaultComponent_Implementation() const override { return VaultComponent; }
virtual UMotionWarpingComponent* GetMotionWarpingComponent_Implementation() const override { return MotionWarpingComponent; }
virtual FVIAnimSet GetVaultAnimSet_Implementation() const override { return VaultAnimSet; }
virtual FVITraceSettings GetVaultTraceSettings_Implementation() const override { return VaultTraceSettings; }
};