add a new heroes push back abilities

This commit is contained in:
Arnaud Jamin
2023-10-05 01:54:26 -04:00
parent ad397dbf7e
commit 27f4b9485a
73 changed files with 1077 additions and 233 deletions
@@ -23,8 +23,12 @@ void ACogAbilityReplicator::Create(APlayerController* Controller)
ACogAbilityReplicator::ACogAbilityReplicator(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
#if !UE_BUILD_SHIPPING
bReplicates = true;
RootComponent = ObjectInitializer.CreateOptionalDefaultSubobject<USceneComponent>(this, TEXT("Root"));
bOnlyRelevantToOwner = true;
#endif // !UE_BUILD_SHIPPING
}
//--------------------------------------------------------------------------------------------------------------------------
@@ -40,20 +44,23 @@ void ACogAbilityReplicator::GetLifetimeReplicatedProps(TArray< FLifetimeProperty
DOREPLIFETIME_WITH_PARAMS_FAST(ACogAbilityReplicator, TweakProfileIndex, Params);
}
//--------------------------------------------------------------------------------------------------------------------------
void ACogAbilityReplicator::BeginPlay()
{
Super::BeginPlay();
OwnerPlayerController = Cast<APlayerController>(GetOwner());
if (OwnerPlayerController->IsLocalController())
if (OwnerPlayerController != nullptr)
{
FCogAbilityModule::Get().SetLocalReplicator(this);
}
else
{
FCogAbilityModule::Get().AddRemoteReplicator(this);
if (OwnerPlayerController->IsLocalController())
{
FCogAbilityModule::Get().SetLocalReplicator(this);
}
else
{
FCogAbilityModule::Get().AddRemoteReplicator(this);
}
}
}
@@ -155,11 +155,11 @@ void UCogAbilityWindow_Cheats::RequestCheat(AActor* CheatInstigator, AActor* Sel
if (ICogInterfacesAllegianceActor* AllegianceInterface = Cast<ICogInterfacesAllegianceActor>(OtherActor))
{
AllegianceInterface->GetAllegiance(CheatInstigator);
AllegianceInterface->GetAllegianceWithOtherActor(CheatInstigator);
}
if ((IsShiftDown && (Allegiance == ECogInterfacesAllegiance::Enemy))
|| (IsAltDown && (Allegiance == ECogInterfacesAllegiance::Ally)))
|| (IsAltDown && (Allegiance == ECogInterfacesAllegiance::Friendly)))
{
Actors.Add(OtherActor);
}