void UHydraComponent::OnRegister() { Super::OnRegister(); //Attach the delegate pointer automatically to the owner of the component ValidSelfPointer = this; SetInterfaceDelegate(GetOwner()); HydraStartup(); }
//Required Overrides void AHydraPluginActor::BeginPlay() { Super::BeginPlay(); //Actors by default aren't attached to the input chain, so we enable input for this actor to forward Key and Gamepad Events APlayerController* PC = UGameplayStatics::GetPlayerController(this, 0); EnableInput(PC); //Required Hydra Initialization ValidSelfPointer = this; //required from v0.7 HydraStartup(); }
void ACinemotusPlayerController::BeginPlay() { Super::BeginPlay(); HydraStartup(); //find all spawn volume actors TArray<AActor*> FoundActors; // UGameplayStatics::GetPlayerPawn(); //static from game engine UGameplayStatics::GetAllActorsOfClass(GetWorld(), APawn::StaticClass(), FoundActors); for (auto Actor : FoundActors) { ACinemotusDefaultPawn* pwn = Cast<ACinemotusDefaultPawn>(Actor); if (pwn) { PawnsInScene.Add(pwn); UCineSceneComponent* cineDataA = pwn->FindComponentByClass<UCineSceneComponent>(); cineDataA->LayerNumber = rand(); //just give random for now } } PawnsInScene.Sort( [](const APawn & a, const APawn & b) { const UCineSceneComponent* cineDataA = a.FindComponentByClass<UCineSceneComponent>(); if (cineDataA != NULL) { const UCineSceneComponent* cineDataB = b.FindComponentByClass<UCineSceneComponent>(); if (cineDataB != NULL) { return cineDataA->LayerNumber < cineDataB->LayerNumber; } return true; } return false; } ); APawn* currentPawn = GetPawn(); currentPawnIndex = 0; for (int i = 0; i < PawnsInScene.Num(); ++i) { if (PawnsInScene[i] == currentPawn) //if (PawnsInScene[i]->ActorHasTag(TEXT("CinemotusCharacter"))) { currentPawnIndex = i -1; if (currentPawnIndex < 0) { currentPawnIndex = PawnsInScene.Num() - 1; } break; } } possessedCinePawn = Cast<ACinemotusDefaultPawn>(GetPawn()); OnSwichPawn(); }
//Required Overrides, forward startup and tick. void AHydraPlayerController::BeginPlay() { Super::BeginPlay(); ValidSelfPointer = this; //required from v0.7 HydraStartup(); }