1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add isometric cell shape mode to AStarGrid2D.

This commit is contained in:
Yuri Roubinski
2023-09-03 14:08:35 +03:00
committed by Yuri Rubinsky
parent f5696c311c
commit 04bb89c0bd
3 changed files with 65 additions and 1 deletions

View File

@@ -56,11 +56,19 @@ public:
HEURISTIC_MAX,
};
enum CellShape {
CELL_SHAPE_SQUARE,
CELL_SHAPE_ISOMETRIC_RIGHT,
CELL_SHAPE_ISOMETRIC_DOWN,
CELL_SHAPE_MAX,
};
private:
Rect2i region;
Vector2 offset;
Size2 cell_size = Size2(1, 1);
bool dirty = false;
CellShape cell_shape = CELL_SHAPE_SQUARE;
bool jumping_enabled = false;
DiagonalMode diagonal_mode = DIAGONAL_MODE_ALWAYS;
@@ -157,6 +165,9 @@ public:
void set_cell_size(const Size2 &p_cell_size);
Size2 get_cell_size() const;
void set_cell_shape(CellShape p_cell_shape);
CellShape get_cell_shape() const;
void update();
bool is_in_bounds(int32_t p_x, int32_t p_y) const;
@@ -193,5 +204,6 @@ public:
VARIANT_ENUM_CAST(AStarGrid2D::DiagonalMode);
VARIANT_ENUM_CAST(AStarGrid2D::Heuristic);
VARIANT_ENUM_CAST(AStarGrid2D::CellShape)
#endif // A_STAR_GRID_2D_H