重构地图系统,增加摄像机控制器管理相机行为。主要变更包括: - 新增 GameCameraController 类,支持跟随目标和调试模式 - 重构 GameMap 类,分离相机逻辑到控制器 - 优化地图资源加载和同步逻辑 - 改进动画系统的事件处理 - 添加地图测试场景用于快速验证
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include "Camera/GameCameraController.h"
|
|
#include "GameDataLoader.h"
|
|
#include "GameMap.h"
|
|
#include <frostbite2D/2d/actor.h>
|
|
#include <vector>
|
|
|
|
namespace frostbite2D {
|
|
|
|
class GameTown : public Actor {
|
|
public:
|
|
struct MapInfo {
|
|
int areaId = -1;
|
|
RefPtr<GameMap> map;
|
|
std::string type;
|
|
Vec2 generatePos = Vec2(-1.0f, -1.0f);
|
|
};
|
|
|
|
GameTown();
|
|
~GameTown() override = default;
|
|
|
|
bool Init(int index, const std::string& townPath);
|
|
void AddCharacter(RefPtr<Actor> actor, int areaIndex = -2);
|
|
|
|
int GetCurAreaIndex() const { return curMapIndex_; }
|
|
RefPtr<GameMap> GetArea(int index) const;
|
|
const std::vector<MapInfo>& GetAreas() const { return mapList_; }
|
|
|
|
void Update(float deltaTime) override;
|
|
|
|
private:
|
|
std::string name_;
|
|
std::string enteringTitle_;
|
|
std::string enteringCutscene_;
|
|
int needQuestId_ = -1;
|
|
int needLevel_ = -1;
|
|
int sariaRoomId_ = -1;
|
|
Vec2 sariaRoomPos_ = Vec2(-1.0f, -1.0f);
|
|
std::vector<MapInfo> mapList_;
|
|
int curMapIndex_ = -1;
|
|
GameCameraController cameraController_;
|
|
};
|
|
|
|
} // namespace frostbite2D
|