feat(地图系统): 增强移动区域调试功能
- 添加移动区域边界结构体MoveAreaBounds并集成到地图配置中 - 实现移动区域索引查找和高亮显示功能 - 增加可移动区域检查开关movableAreaCheckEnabled - 优化调试信息显示,包括坐标和当前所在移动区域 - 重构移动区域相关代码,提高可维护性
This commit is contained in:
@@ -19,6 +19,7 @@ namespace frostbite2D {
|
||||
*/
|
||||
class GameMap : public Actor {
|
||||
public:
|
||||
static constexpr size_t kInvalidMoveAreaIndex = static_cast<size_t>(-1);
|
||||
using MapMoveArea = game::MoveAreaTarget;
|
||||
|
||||
GameMap();
|
||||
@@ -45,11 +46,16 @@ public:
|
||||
/// 检查当前位置是否进入 town move area,用于切图/传送判定。
|
||||
MapMoveArea CheckIsItMoveArea(const Vec3& curPos) const;
|
||||
bool TryGetMoveAreaTarget(const Vec3& curPos, MapMoveArea& outTarget) const;
|
||||
size_t FindMoveAreaIndex(const Vec3& curPos) const;
|
||||
const std::vector<MapMoveArea>& GetMoveAreaInfo() const;
|
||||
size_t GetMoveAreaCount() const { return moveArea_.size(); }
|
||||
Rect GetMovablePositionArea(size_t index) const;
|
||||
const std::string& GetMapPath() const { return mapConfig_.mapPath; }
|
||||
void SetDebugHighlightedMoveAreaIndex(size_t index);
|
||||
|
||||
int GetBackgroundRepeatWidth() const { return backgroundRepeatWidth_; }
|
||||
bool IsDebugModeEnabled() const { return debugMode_; }
|
||||
bool IsMovableAreaCheckEnabled() const { return movableAreaCheckEnabled_; }
|
||||
|
||||
private:
|
||||
/// 初始化固定图层。图层名字与 DNF 地图层概念保持一致。
|
||||
@@ -84,6 +90,8 @@ private:
|
||||
/// 地图配置里的整体 Y 偏移;既影响层位置,也影响地板校准。
|
||||
int mapOffsetY_ = 0;
|
||||
bool debugMode_ = true;
|
||||
/// 硬编码调试开关:关闭后忽略可行走区域检测,允许角色自由移动。
|
||||
bool movableAreaCheckEnabled_ = false;
|
||||
/// 当前地图正在播放的背景音乐。
|
||||
Ptr<Music> currentMusic_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user