Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void APlayerCharacter::ToggleScope(const bool scoped)
- {
- const auto controller = Cast<APlayerController>(GetController());
- if (!controller) return;
- const auto hud = Cast<ASchimmelHUD>(controller->GetHUD());
- if (!hud) return;
- isScoped = scoped;
- if (isScoped == wasScoped) return;
- const auto fov = scoped ? Constants::Actor::Agent::PlayerCharacter::Camera::scopedFOV : UOptionsManager::GetFieldOfView();
- camera->SetFieldOfView(fov);
- OnScopeToggled.Broadcast(scoped);
- wasScoped = isScoped;
- if (scoped) hud->StartHint(HintContexts::Zoom);
- else hud->EndHint();
- if (firstPersonMesh) firstPersonMesh->SetHiddenInGame(scoped);
- if (currentWeapon)
- if (const auto weaponMesh = currentWeapon->GetViewMesh())
- weaponMesh->SetHiddenInGame(scoped);
- }
- void APlayerCharacter::ZoomInOrOut(bool zoomIn)
- {
- const auto oldFOV = camera->FieldOfView;
- auto newFOV = oldFOV;
- if (zoomIn) newFOV -= Constants::Actor::Agent::PlayerCharacter::Camera::scopedFOVDelta;
- else newFOV += Constants::Actor::Agent::PlayerCharacter::Camera::scopedFOVDelta;
- newFOV = FMath::Clamp(newFOV, Constants::Actor::Agent::PlayerCharacter::Camera::minScopedFOV, Constants::Actor::Agent::PlayerCharacter::Camera::maxScopedFOV);
- camera->SetFieldOfView(newFOV);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement