新增GameMap和GameTown类实现游戏地图和城镇的核心功能 添加GameWorld作为游戏世界管理器处理场景切换 完善音频系统支持从路径加载音乐和音效 重构PVF资源系统增加路径规范化功能 添加.gitignore排除游戏资源目录
44 lines
990 B
C++
44 lines
990 B
C++
#pragma once
|
|
|
|
#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;
|
|
};
|
|
|
|
} // namespace frostbite2D
|