Fix camera zone lock bounds
This commit is contained in:
@@ -28,7 +28,10 @@ void CameraController::Configure(const CameraControllerConfig& config) {
|
||||
}
|
||||
|
||||
void CameraController::SetWorldBounds(const frostbite2D::Rect& worldBounds) {
|
||||
config_.worldBounds = worldBounds;
|
||||
const float width = std::max(worldBounds.width(), config_.viewportWidth);
|
||||
const float height = std::max(worldBounds.height(), config_.viewportHeight);
|
||||
config_.worldBounds =
|
||||
frostbite2D::Rect(worldBounds.left(), worldBounds.top(), width, height);
|
||||
}
|
||||
|
||||
void CameraController::SnapToTarget(frostbite2D::Camera& camera,
|
||||
|
||||
@@ -127,11 +127,16 @@ void WhiteboxScene::updateBattleZones() {
|
||||
return;
|
||||
}
|
||||
|
||||
const frostbite2D::Rect playerBounds = player_->GetWorldBounds();
|
||||
if (activeBattleZoneIndex_ >= 0) {
|
||||
const size_t activeIndex = static_cast<size_t>(activeBattleZoneIndex_);
|
||||
if (activeIndex < level_.battleZones.size() &&
|
||||
!level_.battleZones[activeIndex].trigger.intersects(playerBounds)) {
|
||||
clearActiveBattleZone();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const frostbite2D::Rect playerBounds = player_->GetWorldBounds();
|
||||
for (size_t i = 0; i < level_.battleZones.size(); ++i) {
|
||||
BattleZoneRuntime& runtime = battleZoneStates_[i];
|
||||
if (runtime.cleared ||
|
||||
|
||||
Reference in New Issue
Block a user