| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // ----------------------------------------------------------------
- // From Game Programming in C++ by Sanjay Madhav
- // Copyright (C) 2017 Sanjay Madhav. All rights reserved.
- //
- // Released under the BSD License
- // See LICENSE in root directory for full details.
- // ----------------------------------------------------------------
- #pragma once
- #include "Actor.h"
- #include <vector>
- class Tile : public Actor
- {
- public:
- friend class Grid;
- enum TileState
- {
- EDefault,
- EPath,
- EStart,
- EBase
- };
-
- Tile(class Game* game);
-
- void SetTileState(TileState state);
- TileState GetTileState() const { return mTileState; }
- void ToggleSelect();
- const Tile* GetParent() const { return mParent; }
- private:
- // For pathfinding
- std::vector<Tile*> mAdjacent;
- Tile* mParent;
- float f;
- float g;
- float h;
- bool mInOpenSet;
- bool mInClosedSet;
- bool mBlocked;
-
- void UpdateTexture();
- class SpriteComponent* mSprite;
- TileState mTileState;
- bool mSelected;
- };
|