载入中...
搜索中...
未找到
Pathfinder.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "map/FlowField.h"
6#include "map/Path.h"
7#include "map/TileLayer.h"
8
9#include <memory>
10#include <functional>
11#include <string>
12
13namespace eve::map {
14
21public:
23 Pathfinder();
25 explicit Pathfinder(TileLayer *layer);
27 explicit Pathfinder(int width, int height);
30
32 Pathfinder(Pathfinder &&) noexcept;
34 Pathfinder &operator=(Pathfinder &&) noexcept;
35 Pathfinder(const Pathfinder &) = delete;
36 Pathfinder &operator=(const Pathfinder &) = delete;
37
39 void bindLayer(TileLayer *layer);
41 void setSize(int width, int height);
42
43 // --- Grid config (script-friendly) ---
45 void setTopology(const std::string &name);
47 std::string getTopology() const;
49 void setDiagonal(bool enable);
51 bool getDiagonal() const;
53 void blockGid(int gid);
55 void unblockGid(int gid);
57 void clearBlockedGids();
59 void setBlockEmpty(bool enable);
61 bool getBlockEmpty() const;
63 void setBlocked(int x, int y, bool blocked);
65 bool isWalkable(int x, int y) const;
67 void setCellCost(int x, int y, float cost);
69 float getCellCost(int x, int y) const;
71 void syncFromLayer();
72
77 Path *findPath(int sx, int sy, int gx, int gy);
78
91 Path *findPath(int sx, int sy, int gx, int gy,
93 const std::function<float(int, int)> &entryPenalty);
94
96 FlowField *buildFlowField(int gx, int gy);
97
100 Path *followFlow(FlowField *field, int sx, int sy);
101
106 Path *findGroupPath(int sx, int sy, int gx, int gy);
107
109 void invalidateCache();
110
111private:
112 struct Impl;
113 std::unique_ptr<Impl> impl_;
114};
115
116} // namespace eve::map
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
eve::resource::CostSpec cost
#define EVENGINE_API_WORLD
Definition Export.h:109
std::uint32_t height
std::uint32_t width
std::string name
TileLayer * layer
MigrationFunction function
Integration + direction field for group pathfinding to a single goal. nextX/nextY point to the neighb...
Definition FlowField.h:15
Ordered tile-index waypoints from start to goal (inclusive).
Definition Path.h:10
Pathfinding facade. Single-agent: A*. Group (same goal): Flow Field + follow. Grid/topology internals...
Definition Pathfinder.h:20
~Pathfinder()
Pathfinder.
Pathfinder(Pathfinder &&) noexcept
Pathfinder.
ECS tile layer entity. Script mutates tile GIDs / tileset / draw; TileRenderSystem batch-draws atlas ...
Definition TileLayer.h:32
放置世界:格子占用(多通道)+ 地形语义 + 已放置建筑实例。 行为由 PlacementSystem 提供;本类暴露便于脚本绑定的薄封装方法。 坐标换算统一走 eve::grid(支持 rectang...