feat: 添加游戏数学工具类并重构相关代码
refactor: 将数学工具函数移至GameMath类 feat(音频): 实现地图音频控制器 feat(调试): 添加游戏调试UI组件 feat(地图): 增加移动区域边界获取方法 fix(角色): 修复角色移动区域抑制逻辑 refactor(世界): 重构游戏世界场景初始化 docs(音频): 完善音频数据库注释
This commit is contained in:
@@ -25,6 +25,7 @@ public:
|
||||
|
||||
int GetCurAreaIndex() const { return curMapIndex_; }
|
||||
RefPtr<GameMap> GetArea(int index) const;
|
||||
RefPtr<GameMap> GetCurrentArea() const;
|
||||
const std::vector<MapInfo>& GetAreas() const { return mapList_; }
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
namespace frostbite2D {
|
||||
|
||||
class Actor;
|
||||
class CharacterObject;
|
||||
class GameDebugUIScene;
|
||||
class GameMap;
|
||||
|
||||
class GameWorld : public Scene {
|
||||
public:
|
||||
GameWorld();
|
||||
@@ -19,6 +24,13 @@ public:
|
||||
void AddCharacter(RefPtr<Actor> actor, int townId);
|
||||
void MoveCharacter(RefPtr<Actor> actor, int townId, int area);
|
||||
void RequestMoveCharacter(RefPtr<Actor> actor, int townId, int area);
|
||||
void UpdateMoveAreaSuppression(GameMap* map, size_t moveAreaIndex);
|
||||
bool ShouldSuppressMoveArea(GameMap* map, size_t moveAreaIndex) const;
|
||||
|
||||
Actor* GetMainActor() const;
|
||||
CharacterObject* GetMainCharacter() const;
|
||||
GameTown* GetCurrentTown() const;
|
||||
GameMap* GetCurrentMap() const;
|
||||
|
||||
static GameWorld* GetWorld();
|
||||
|
||||
@@ -29,13 +41,25 @@ private:
|
||||
int area = -1;
|
||||
};
|
||||
|
||||
struct SuppressedMoveArea {
|
||||
GameMap* map = nullptr;
|
||||
size_t moveAreaIndex = GameMap::kInvalidMoveAreaIndex;
|
||||
};
|
||||
|
||||
bool InitWorld();
|
||||
bool InitMainCharacter(int townId);
|
||||
void ProcessPendingCharacterMove();
|
||||
void EnsureDebugScene();
|
||||
void RefreshDebugContext();
|
||||
void SetSuppressedMoveArea(GameMap* map, size_t moveAreaIndex);
|
||||
void ClearSuppressedMoveArea();
|
||||
|
||||
std::map<int, std::string> townPathMap_;
|
||||
std::map<int, RefPtr<GameTown>> townMap_;
|
||||
RefPtr<Actor> mainActor_;
|
||||
RefPtr<GameDebugUIScene> debugScene_;
|
||||
std::optional<PendingCharacterMove> pendingCharacterMove_;
|
||||
std::optional<SuppressedMoveArea> suppressedMoveArea_;
|
||||
int curTown_ = -1;
|
||||
bool initialized_ = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user