Add camera zone lock
This commit is contained in:
@@ -37,15 +37,43 @@ void drawCross(const frostbite2D::Vec2& position,
|
||||
color);
|
||||
}
|
||||
|
||||
BattleZoneDebugState resolveZoneState(
|
||||
size_t zoneIndex, const std::vector<BattleZoneDebugInfo>* debugInfo) {
|
||||
if (!debugInfo) {
|
||||
return BattleZoneDebugState::Idle;
|
||||
}
|
||||
|
||||
for (const BattleZoneDebugInfo& info : *debugInfo) {
|
||||
if (info.zoneIndex == zoneIndex) {
|
||||
return info.state;
|
||||
}
|
||||
}
|
||||
return BattleZoneDebugState::Idle;
|
||||
}
|
||||
|
||||
frostbite2D::Color zoneColor(BattleZoneDebugState state) {
|
||||
switch (state) {
|
||||
case BattleZoneDebugState::Active:
|
||||
return frostbite2D::Color(1.0f, 0.82f, 0.15f, 0.95f);
|
||||
case BattleZoneDebugState::Cleared:
|
||||
return frostbite2D::Color(0.45f, 0.48f, 0.52f, 0.65f);
|
||||
case BattleZoneDebugState::Idle:
|
||||
default:
|
||||
return frostbite2D::Color(0.95f, 0.25f, 0.25f, 0.9f);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void DebugOverlay::Render(const LevelDefinition& level, const DebugFlags& flags,
|
||||
const frostbite2D::Rect* playerBounds) const {
|
||||
const frostbite2D::Rect* playerBounds,
|
||||
const std::vector<BattleZoneDebugInfo>*
|
||||
battleZoneDebug) const {
|
||||
if (flags.showCollision) {
|
||||
drawCollision(level);
|
||||
}
|
||||
if (flags.showBattleZones) {
|
||||
drawBattleZones(level);
|
||||
drawBattleZones(level, battleZoneDebug);
|
||||
}
|
||||
if (flags.showSpawnPoints) {
|
||||
drawSpawnPoints(level);
|
||||
@@ -65,9 +93,12 @@ void DebugOverlay::drawActorBounds(const frostbite2D::Rect& bounds) const {
|
||||
drawOutline(bounds, frostbite2D::Color(1.0f, 0.78f, 0.1f, 0.9f));
|
||||
}
|
||||
|
||||
void DebugOverlay::drawBattleZones(const LevelDefinition& level) const {
|
||||
for (const BattleZoneDefinition& zone : level.battleZones) {
|
||||
drawOutline(zone.trigger, frostbite2D::Color(0.95f, 0.25f, 0.25f, 0.9f),
|
||||
void DebugOverlay::drawBattleZones(
|
||||
const LevelDefinition& level,
|
||||
const std::vector<BattleZoneDebugInfo>* battleZoneDebug) const {
|
||||
for (size_t i = 0; i < level.battleZones.size(); ++i) {
|
||||
const BattleZoneDefinition& zone = level.battleZones[i];
|
||||
drawOutline(zone.trigger, zoneColor(resolveZoneState(i, battleZoneDebug)),
|
||||
3.0f);
|
||||
drawOutline(zone.cameraBounds,
|
||||
frostbite2D::Color(0.25f, 0.55f, 1.0f, 0.75f), 2.0f);
|
||||
|
||||
Reference in New Issue
Block a user