void ASZombieAIController::Possess(class APawn* InPawn) { Super::Possess(InPawn); ASZombieCharacter* ZombieBot = Cast<ASZombieCharacter>(InPawn); if (ZombieBot) { if (ZombieBot->BehaviorTree->BlackboardAsset) { BlackboardComp->InitializeBlackboard(*ZombieBot->BehaviorTree->BlackboardAsset); /* Make sure the Blackboard has the type of bot we possessed */ SetBlackboardBotType(ZombieBot->BotType); } BehaviorComp->StartTree(*ZombieBot->BehaviorTree); } }
void ACitizenAIController::Possess(class APawn* InPawn) { Super::Possess(InPawn); ACitizenAICharacter* CitiActor = Cast<ACitizenAICharacter>(InPawn); if (CitiActor) { SightConfig->SightRadius = CitiActor->SightRangeValue; SightConfig->PeripheralVisionAngleDegrees = CitiActor->PeripheralRangeValue; AIPerceptionComp->OnPerceptionUpdated.AddDynamic(this, &ACitizenAIController::SenseStuff); AIPerceptionComp->ConfigureSense(*SightConfig); if (CitiActor->BehaviorTree->BlackboardAsset) { BlackboardComp->InitializeBlackboard(*CitiActor->BehaviorTree->BlackboardAsset); /* Make sure the Blackboard has the type of bot we possessed */ SetBlackboardBotType(CitiActor->BotType); } BehaviorComp->StartTree(*CitiActor->BehaviorTree); } }