这篇教程C++ GetPawn函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetPawn函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPawn函数的具体用法?C++ GetPawn怎么用?C++ GetPawn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetPawn函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: OnFirevoid AZanshinAIController::OnFire(){ AZanshinBot* character = Cast<AZanshinBot>(GetPawn()); if (character) { character->OnFire(character->GetActorLocation(), character->GetActorRotation()); }}
开发者ID:JuanCCS,项目名称:Zanshin,代码行数:7,
示例2: Possessvoid AAIController::Possess(APawn* InPawn){ Super::Possess(InPawn); if (!GetPawn()) { return; } // no point in doing navigation setup if pawn has no movement component const UPawnMovementComponent* MovementComp = InPawn->GetMovementComponent(); if (MovementComp != NULL) { UpdateNavigationComponents(); } if (PathFollowingComponent) { PathFollowingComponent->Initialize(); } if (bWantsPlayerState) { ChangeState(NAME_Playing); } OnPossess(InPawn);}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:28,
示例3: GetPawn/** Function called to search for an enemy - parameter void: - returns: void */void AEnemyController::SearchForEnemy(){ APawn* MyEnemy = GetPawn(); if (MyEnemy == NULL) return; const FVector MyLoc = MyEnemy->GetActorLocation(); float BestDistSq = MAX_FLT; ATankCharacter* BestPawn = NULL; for (FConstPawnIterator It = GetWorld()->GetPawnIterator(); It; It++) { ATankCharacter* TestPawn = Cast<ATankCharacter>(*It); if (TestPawn) { const float DistSq = FVector::Dist(TestPawn->GetActorLocation(), MyLoc); bool canSee = LineOfSightTo(TestPawn); //choose the closest option to the AI that can be seen if (DistSq < BestDistSq && canSee) { BestDistSq = DistSq; BestPawn = TestPawn; } } } if (BestPawn) { GEngine->AddOnScreenDebugMessage(0, 1.0f, FColor::Green, BestPawn->GetName()); SetEnemy(BestPawn); }}
开发者ID:burnsm,项目名称:Tanks,代码行数:40,
示例4: GetPawnvoid AMyPlayerController::SetNewMoveDestination(const FVector DestLocation){ if (!bIsPaused) { AMyAnt* MyAnt = Cast<AMyAnt>(UGameplayStatics::GetPlayerCharacter(this, 0)); APawn* const Pawn = GetPawn(); if (Pawn) { /*MyAnt->SetActorLocation(FMath::Lerp(MyAnt->GetActorLocation(), FVector(DestinationLocation.X, DestinationLocation.Y, MyAnt->GetActorLocation().Z), ToLocationCounter),true); if (ToLocationCounter >= 1.0f) { MovingToLocation = false; ToLocationCounter = 0; }*/ UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem(); float const Distance = FVector::Dist(DestLocation, Pawn->GetActorLocation()); // We need to issue move command only if far enough in order for walk animation to play correctly if (NavSys && (Distance > 120.0f)) { NavSys->SimpleMoveToLocation(this, DestLocation); } } }}
开发者ID:clairvoyantgames,项目名称:YOLA,代码行数:25,
示例5: GetFocalPointvoid AAIController::UpdateControlRotation(float DeltaTime, bool bUpdatePawn){ // Look toward focus FVector FocalPoint = GetFocalPoint(); APawn* const Pawn = GetPawn(); if (Pawn) { FVector Direction = FAISystem::IsValidLocation(FocalPoint) ? (FocalPoint - Pawn->GetPawnViewLocation()) : Pawn->GetActorForwardVector(); FRotator NewControlRotation = Direction.Rotation(); // Don't pitch view unless looking at another pawn if (Cast<APawn>(GetFocusActor()) == nullptr) { NewControlRotation.Pitch = 0.f; } NewControlRotation.Yaw = FRotator::ClampAxis(NewControlRotation.Yaw); if (GetControlRotation().Equals(NewControlRotation, 1e-3f) == false) { SetControlRotation(NewControlRotation); if (bUpdatePawn) { Pawn->FaceRotation(NewControlRotation, DeltaTime); } } }}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:29,
示例6: whilevoid ACinemotusPlayerController::OnSwichPawn(bool increase){ //Get Current Pawn's rotation? if (PawnsInScene.Num() < 1) { return; } FString numstr = FString::Printf(TEXT("%d"), PawnsInScene.Num()); GEngine->AddOnScreenDebugMessage(-1, .5f, FColor::Yellow, numstr); int startIndex = currentPawnIndex; do { if (increase) { currentPawnIndex = currentPawnIndex + 1 < PawnsInScene.Num() ? currentPawnIndex + 1 : 0; } else { currentPawnIndex = currentPawnIndex - 1 < 0 ? PawnsInScene.Num() - 1 : currentPawnIndex - 1; } } while (PawnsInScene[currentPawnIndex]->bHidden && currentPawnIndex != startIndex); //keep going till we find a non hidden one APawn* nextPawn = PawnsInScene[currentPawnIndex]; Possess(nextPawn); SetViewTargetWithBlend(nextPawn, 0.0f); possessedCinePawn = Cast<ACinemotusDefaultPawn>(nextPawn); //GET JOYSTICK DATA GetCineData(GetPawn());}
开发者ID:erinmichno,项目名称:CinemotusUE4,代码行数:31,
示例7: releaseFrisbeevoid AFrisbeeNulPlayerController::releaseFrisbee(){ this->frisbee->unattachToPlayer(); this->frisbee->mesh->SetPhysicsLinearVelocity(FVector(0, 0, 0)); this->frisbee->mesh->AddForce(GetPawn()->GetActorForwardVector() * 10000000);}
开发者ID:Wincked,项目名称:FrisbeeNul,代码行数:7,
示例8: FindClosestEnemybool AMyAIController::FindClosestEnemy(){ AMyChar* mySelf = Cast<AMyChar>(GetPawn()); if (!mySelf) return false; const FVector myLoc = mySelf->GetActorLocation(); float BestDistSq = MAX_FLT; AMyChar * bestTarget = nullptr; for (FConstPawnIterator iter = GetWorld()->GetPawnIterator(); iter; ++iter) { AMyChar* tmpTarget = Cast<AMyChar>(*iter); if (tmpTarget != mySelf) { if (tmpTarget) { const float DistSq = (tmpTarget->GetActorLocation() - myLoc).SizeSquared(); if (DistSq < BestDistSq) { BestDistSq = DistSq; bestTarget = tmpTarget; FString str = FString::Printf(TEXT("--- find enemy dist:%f"), BestDistSq); GEngine->AddOnScreenDebugMessage(0, 2.0f, FColor::Red, str); } } } } if (bestTarget) { return SetEnemy(bestTarget); } return false;}
开发者ID:yangxuan0261,项目名称:SlateSrc,代码行数:35,
示例9: GetPawnvoid AFrisbeeNulPlayerController::MoveRight(float AxisValue){ APawn* const Pawn = GetPawn(); if (Pawn && this->frisbee->playerOwner != Pawn) { Pawn->AddMovementInput(FVector::RightVector, FMath::Clamp<float>(AxisValue, -1.0f, 1.0f), false); }}
开发者ID:Wincked,项目名称:FrisbeeNul,代码行数:7,
示例10: getFrisbeevoid AFrisbeeNulPlayerController::getFrisbee(){ this->frisbee->attachToPlayer(GetPawn()); this->frisbee->SetActorRelativeLocation(FVector(0, 0, 230));}
开发者ID:Wincked,项目名称:FrisbeeNul,代码行数:7,
示例11: GetPawnvoid AMapPlayerController::CameraMoveRight(float d){ if (d != 0.0f) { GetPawn()->AddActorWorldOffset(FVector(0, CameraMoveDistance * d, 0)); }}
开发者ID:Milias,项目名称:ddsimulator,代码行数:7,
示例12: FindNearestWaypointAMWWaypoint* AMWPatController::FindNearestWaypoint(bool bSetAsNext){ const AMWPat* pat = Cast<AMWPat>(GetPawn()); if (!pat) { return nullptr; } float minDist = MAX_FLT; AMWWaypoint* nearestWp = nullptr; // get all the waypoints in the level TArray<AActor*> foundActors; UGameplayStatics::GetAllActorsOfClass(this, AMWWaypoint::StaticClass(), foundActors); if (!foundActors.Num()) { UE_LOG(LogTemp, Error, TEXT("No waypoints in the level")); return nullptr; } for (AActor* actor : foundActors) { const float dist = (pat->GetActorLocation() - actor->GetActorLocation()).SizeSquared(); AMWWaypoint* waypoint = Cast<AMWWaypoint>(actor); const FString patTag = pat->WaypointTag; const FString wpTag = waypoint->Tag; // tags must match if (dist < minDist && patTag == wpTag) { minDist = dist; nearestWp = waypoint; } } if (!nearestWp) { UE_LOG(LogTemp, Error, TEXT("Pat %s couldn't find a waypoint with matching tag %s"), *pat->GetName(), *pat->WaypointTag); return nullptr; } // check whether we are already stand on that waypoint // normally waypoints stay far away from each other, so there is only one possible overlapping at a given time TArray<AActor*> overlaps; pat->GetOverlappingActors(overlaps, AMWWaypoint::StaticClass()); if (overlaps.Num() && overlaps[0] == nearestWp) { check(nearestWp->Next) nearestWp = nearestWp->Next; } if (nearestWp && bSetAsNext) { SetNextWaypoint(nearestWp); } return nearestWp;}
开发者ID:Mingism,项目名称:MicroWave,代码行数:60,
示例13: GetPawnvoid ASoftDesignTrainingPlayerController::OnTakeCoverPressed(){ APawn* const Pawn = GetPawn(); if (Pawn) { FVector actorLocation = Pawn->GetActorLocation(); FRotator actorRotation = Pawn->GetActorRotation(); FVector coverTestStart = actorLocation; FVector coverTestEnd = actorLocation + 400.0f * actorRotation.Vector(); UWorld* currentWorld = GetWorld(); static FName InitialCoverSweepTestName = TEXT("InitialCoverSweepTest"); FHitResult hitResult; FQuat shapeRot = FQuat::Identity; FCollisionShape collShape = FCollisionShape::MakeSphere(Pawn->GetSimpleCollisionRadius()); FCollisionQueryParams collQueryParams(InitialCoverSweepTestName, false, Pawn); currentWorld->DebugDrawTraceTag = InitialCoverSweepTestName; FCollisionObjectQueryParams collObjQueryParams(ECC_WorldStatic); UDesignTrainingMovementComponent* charMovement = Cast<UDesignTrainingMovementComponent>(Pawn->GetMovementComponent()); if (currentWorld->SweepSingleByObjectType(hitResult, coverTestStart, coverTestEnd, shapeRot, collObjQueryParams, collShape, collQueryParams)) { if (charMovement->ValidateCover(hitResult)) { MoveToCoverDestination(hitResult.Location); } } }}
开发者ID:UbisoftDirMet,项目名称:SoftDesignTraining,代码行数:32,
示例14: GetPawnvoid AAIController::UnPossess(){ APawn* CurrentPawn = GetPawn(); Super::UnPossess(); if (PathFollowingComponent) { PathFollowingComponent->Cleanup(); } if (bStopAILogicOnUnposses) { if (BrainComponent) { BrainComponent->Cleanup(); } } if (CachedGameplayTasksComponent && (CachedGameplayTasksComponent->GetOwner() == CurrentPawn)) { CachedGameplayTasksComponent->OnClaimedResourcesChange.RemoveDynamic(this, &AAIController::OnGameplayTaskResourcesClaimed); CachedGameplayTasksComponent = nullptr; } OnUnpossess(CurrentPawn);}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:27,
示例15: Finishbool UPawnAction_Repeat::PushSubAction(){ if (ActionToRepeat == NULL) { Finish(EPawnActionResult::Failed); return false; } else if (RepeatsLeft == 0) { Finish(EPawnActionResult::Success); return true; } if (RepeatsLeft > 0) { --RepeatsLeft; } UPawnAction* ActionCopy = SubActionTriggeringPolicy == EPawnSubActionTriggeringPolicy::CopyBeforeTriggering ? Cast<UPawnAction>(StaticDuplicateObject(ActionToRepeat, this, NULL)) : ActionToRepeat; UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("%s> pushing repeted action %s %s, repeats left: %d") , *GetName(), SubActionTriggeringPolicy == EPawnSubActionTriggeringPolicy::CopyBeforeTriggering ? TEXT("copy") : TEXT("instance") , *GetNameSafe(ActionCopy), RepeatsLeft); check(ActionCopy); RecentActionCopy = ActionCopy; return PushChildAction(*ActionCopy); }
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:29,
示例16: UE_LOGvoid ATankAIController::onPossedTankDeath(){ UE_LOG(LogTemp, Warning, TEXT("%s Is Dead"), *GetPawn()->GetName()) possessedTank->DetachFromControllerPendingDestroy();}
开发者ID:Unreal-Learning-Courses,项目名称:Udemy-UE-Cplusplus-Section-04,代码行数:7,
示例17: UE_LOGFPathFollowingRequestResult AWalkerAIController::MoveTo( const FAIMoveRequest& MoveRequest, FNavPathSharedPtr* OutPath){#ifdef CARLA_AI_WALKERS_EXTRA_LOG UE_LOG(LogCarla, Log, TEXT("Walker %s requested move from (%s) to (%s)"), *GetPawn()->GetName(), *GetPawn()->GetActorLocation().ToString(), *MoveRequest.GetGoalLocation().ToString());#endif // CARLA_AI_WALKERS_EXTRA_LOG ChangeStatus(EWalkerStatus::Moving); return Super::MoveTo(MoveRequest, OutPath);}
开发者ID:cyy1991,项目名称:carla,代码行数:16,
示例18: GetPawnvoid ACinemotusPlayerController::AbsoluteTick(float DeltaTime){ TotalYawAbs += addYaw; UPrimitiveComponent* prim = GetPawn()->GetMovementComponent()->UpdatedComponent; //USceneComponent* sComponent = GetPawn()->GetRootComponent(); //sComponent->SetRelativeLocation; bool SetPrimDirectly = true; FQuat finalQuat; if (((currentCaptureState&ECinemotusCaptureState::EAbsolute) == ECinemotusCaptureState::EAbsolute) && ((currentCaptureState&ECinemotusCaptureState::EAbsoluteOff) == 0)) { finalQuat = FRotator(0, TotalYawAbs, 0).Quaternion()*(HydraLatestData->controllers[CAM_HAND].quat); } else { finalQuat = FRotator(0, addYaw, 0).Quaternion()*prim->GetComponentQuat(); } SetControlRotation(finalQuat.Rotator()); if (SetPrimDirectly && prim) { prim->SetWorldLocationAndRotation(prim->GetComponentLocation(), finalQuat);// not sure need } HandleMovementAbs(DeltaTime, ((currentCaptureState&ECinemotusCaptureState::EAbsolute) == ECinemotusCaptureState::EAbsolute));}
开发者ID:erinmichno,项目名称:CinemotusUE4,代码行数:30,
示例19: FHitResultvoid ALMPlayerController::PawnRotationToTarget(){ if (this->bIsRotationChange) { FHitResult CursorHitRes = FHitResult(); if (GetHitResultUnderCursor(ECollisionChannel::ECC_Visibility, false, CursorHitRes)) { FVector FaceDir = CursorHitRes.Location - GetPawn()->GetActorLocation(); FRotator FaceRotator = FaceDir.Rotation(); FaceRotator.Pitch = 0; FaceRotator.Roll = 0; GetPawn()->SetActorRotation(FaceRotator); } }}
开发者ID:willcong,项目名称:LonelyMen,代码行数:16,
示例20: GetPawnvoid ATankAIController::Tick(float DeltaSeconds){ Super::Tick(DeltaSeconds); auto aiTank = GetPawn(); auto playerTank = GetWorld()->GetFirstPlayerController()->GetPawn(); if (ensure(playerTank)) { // TODO Move towards the player MoveToActor(playerTank, acceptanceRadius); // TODO check radius is in cm // Aim towards the player auto aimComponent = aiTank->FindComponentByClass<UTankAimingComponent>(); aimComponent->AimAt(playerTank->GetActorLocation()); //GetPawn().reloadTimeInSeconds = 10; // Fire if ready if (aimComponent->GetFiringState() == EFiringStatus::Ready) { aimComponent->Fire(); //UE_LOG(LogTemp,Warning,TEXT("AI Tank Ready and Firing!")) } }}
开发者ID:Unreal-Learning-Courses,项目名称:Udemy-UE-Cplusplus-Section-04,代码行数:27,
示例21: GetPawnvoid ACitizenAIController::SetCurrentPosition(){ if (BlackboardComp) { BlackboardComp->SetValueAsVector(CurrentPositionName, GetPawn()->GetActorLocation()); }}
开发者ID:VirtuosoVirtual,项目名称:Prometheus,代码行数:7,
示例22: GetPawnvoid ATankPlayerController::BeginPlay(){ Super::BeginPlay(); auto AimingComponent = GetPawn()->FindComponentByClass<UTankAimingComponent>(); if (!ensure(AimingComponent)) { return; } FoundAimingComponent(AimingComponent);}
开发者ID:cabrinhaFx,项目名称:BattleTank,代码行数:7,
示例23: GetWorldvoid ACubeDeathController::TickActor(float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction){ Super::TickActor(DeltaTime, TickType, ThisTickFunction); if(waiting) { if(breakTimer >= 0) { breakTimer -= DeltaTime; } else { // Spawn the shockwave playerCube->OnDeath(explosionForce); //Tell the gamemode that we are dead if(GetWorld() != nullptr) { ACubeWarsGameMode* cwgm = GetWorld()->GetAuthGameMode<ACubeWarsGameMode>(); cwgm->playerDied(teamNumber); } //Destroy actor GetPawn()->Destroy(); } }}
开发者ID:e0925357,项目名称:CubeWars,代码行数:29,
示例24: RotateYvoid ACarController::RotateY(float axisValue){ APawnCar* car = Cast<APawnCar>(GetPawn()); if (car == nullptr) return; rotation.Roll = FMath::Clamp(axisValue, -1.0f, 1.0f); car->SetRotationDirection(rotation);}
开发者ID:Caresilabs,项目名称:MAH_Arena_UnrealProject,代码行数:8,
示例25: Thrustvoid ACarController::Thrust(float value){ APawnCar* car = Cast<APawnCar>(GetPawn()); if (car == nullptr) return; if (value > 0) car->Thrust(value);}
开发者ID:Caresilabs,项目名称:MAH_Arena_UnrealProject,代码行数:8,
示例26: ServerSuicide_Implementationvoid ASPlayerController::ServerSuicide_Implementation(){ ASCharacter* MyPawn = Cast<ASCharacter>(GetPawn()); if (MyPawn && ((GetWorld()->TimeSeconds - MyPawn->CreationTime > 1) || (GetNetMode() == NM_Standalone))) { MyPawn->Suicide(); }}
开发者ID:2954722256,项目名称:EpicSurvivalGameSeries,代码行数:8,
示例27: PrevWeaponvoid ATDownPlayerController::PrevWeapon(){ ATDownCharacter* GetChar = Cast<ATDownCharacter>(GetPawn()); if (GetChar) { GetChar->PrevWeapon(); }}
开发者ID:Dredfort,项目名称:TDown,代码行数:8,
示例28: UE_VLOGbool UPawnAction_Sequence::Start(){ bool bResult = Super::Start(); if (bResult) { UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT("Starting sequence. Items:"), *GetName()); for (auto Action : ActionSequence) { UE_VLOG(GetPawn(), LogPawnAction, Log, TEXT(" %s"), *GetNameSafe(Action)); } bResult = PushNextActionCopy(); } return bResult;}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:17,
示例29: GetWorldvoid ATankAIController::Tick(float deltaTime){ Super::Tick(deltaTime); auto playerTank = GetWorld()->GetFirstPlayerController()->GetPawn(); if (ensure(playerTank && GetPawn())) { MoveToActor(playerTank, acceptanceRadius); auto aimingComponent = GetPawn()->FindComponentByClass<UTankAimingComponent>(); aimingComponent->AimAt(playerTank->GetActorLocation()); if(aimingComponent->GetFiringStatus() == EFiringStatus::Locked) aimingComponent->Fire(); }}
开发者ID:Seank23,项目名称:BattleTank,代码行数:17,
示例30: MoveForwardvoid ACarController::MoveForward(float axisValue){ APawnCar* car = Cast<APawnCar>(GetPawn()); if (car == nullptr) return; direction.Y = FMath::Clamp(axisValue, -1.0f, 1.0f); car->SetDirection(direction);}
开发者ID:Caresilabs,项目名称:MAH_Arena_UnrealProject,代码行数:9,
注:本文中的GetPawn函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetPciAddress函数代码示例 C++ GetPathName函数代码示例 |