void ATopDown_HitmanCleanPlayerController::PlayerTick(float DeltaTime){ Super::PlayerTick(DeltaTime); // keep updating the destination every tick while desired if (bMoveToMouseCursor){ MoveToMouseCursor(); } }
void ATDownPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime); if (CurrentGameMode) { // get state from game mode and stops player movement switch (CurrentGameMode->GetCurrentState()) { case EGamePlayerState::GS_Player: { bIsCanMoove = true; break; } case EGamePlayerState::GS_Bot: { bIsCanMoove = false; break; } case EGamePlayerState::GS_Unknown: { break; } default: bIsCanMoove = true; break; } } else { //GEngine->AddOnScreenDebugMessage(-1, 2, FColor::Red, TEXT("____________ CurrentGameMode FAIL!!!!____________"),true,); } /*if (CurrentGameMode->GetCurrentState() == EGamePlayerState::GS_Player) { bIsCanMoove = true; } else { if (CurrentGameMode->GetCurrentState() == EGamePlayerState::GS_Bot) { bIsCanMoove = false; } else { bIsCanMoove = true; } }*/ // keep updating the destination every tick while desired if (bMoveToMouseCursor && bIsCanMoove) { MoveToMouseCursor(); } }
void AEventExampleProjectPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime); // keep updating the destination every tick while desired if (bMoveToMouseCursor) { MoveToMouseCursor(); } }
void AMetalHeadsPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime); // keep updating the destination every tick while desired if (bMoveToMouseCursor) { MoveToMouseCursor(); } }
void AFrisbeeNulPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime); // keep updating the destination every tick while desired if (bMoveToMouseCursor && this->frisbee->playerOwner != GetPawn()) { MoveToMouseCursor(); } }
void ATwinStickShooterPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime); // keep updating the destination every tick while desired if (false) { MoveToMouseCursor(); } if (bLookAtMouseCursor) { LookAtMouseCursor(); } }
void AMyPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime); // keep updating the destination every tick while desired if (bMoveToMouseCursor) { MoveToMouseCursor(); } /*if (MovingToLocation) { ToLocationCounter += (DeltaTime * .1); SetNewMoveDestination(); }*/ }
void ABaleroPlayerController::OnRightClickPressed() { UE_LOG(LogTemp, Warning, TEXT("rightclick")); FHitResult Hit; GetHitResultUnderCursor(ECC_Visibility, false, Hit); FVector2D MouseLocation; GetMousePosition(MouseLocation.X, MouseLocation.Y); int32 ViewportX; int32 ViewportY; GetViewportSize(ViewportX, ViewportY); if (MouseLocation.X > ViewportX * .9f) { return; } if (Hit.bBlockingHit) { UE_LOG(LogTemp, Warning, TEXT("rightclickedsomething")); APawn* pawn = Cast<APawn>(Hit.GetActor()); if (pawn != NULL) { UE_LOG(LogTemp, Warning, TEXT("clicked pawn")); ABaleroCharacter* Unit = Cast<ABaleroCharacter>(pawn); if (Unit != NULL) { MoveToActor(Unit); } } else { MoveToMouseCursor(); } } }
void ABaleroPlayerController::OnClickPressed() { UE_LOG(LogTemp, Warning, TEXT("clickpressed")); FHitResult Hit; GetHitResultUnderCursor(ECC_Visibility, false, Hit); FVector2D MouseLocation; GetMousePosition(MouseLocation.X, MouseLocation.Y); int32 ViewportX; int32 ViewportY; GetViewportSize(ViewportX, ViewportY); if (MouseLocation.X > ViewportX * .9f) { return; } if (Hit.bBlockingHit) { UE_LOG(LogTemp, Warning, TEXT("clickedsomething")); APawn* pawn = Cast<APawn>(Hit.GetActor()); if (pawn != NULL) { UE_LOG(LogTemp, Warning, TEXT("clicked pawn")); ABaleroCharacter* Unit = Cast<ABaleroCharacter>(pawn); if (Unit != NULL) { //deselect the clicked unit if (SelectedUnits.Contains(Unit)) { RemoveUnitFromSelection(Unit); } //add unit to selection else { AddUnitToSelection(Unit); } } } else { //give move command to move UE_LOG(LogTemp, Warning, TEXT("MOVE COMMAND_A")); for (ABaleroCharacter* Unit : SelectedUnits) { AAIControllerBase* AIControl = Cast<AAIControllerBase>(Unit->GetController()); FVector loc = Unit->GetActorLocation(); UE_LOG(LogTemp, Warning, TEXT("Unit ai: %s , pos: %.1f %.1f %.1f"), *(AActor::GetDebugName(AIControl)), loc.X, loc.Y, loc.Z); } MoveToMouseCursor(); } } else { UE_LOG(LogTemp, Warning, TEXT("MOVE COMMAND_B")); MoveToMouseCursor(); } }