推
This commit is contained in:
@@ -10,6 +10,7 @@ class BaseObject;
|
||||
class GameMapCamera;
|
||||
class GameMap : public Actor
|
||||
{
|
||||
public:
|
||||
struct BackGroundAni
|
||||
{
|
||||
std::string filename;
|
||||
@@ -37,13 +38,14 @@ class GameMap : public Actor
|
||||
|
||||
struct MapMoveArea
|
||||
{
|
||||
int town;
|
||||
int area;
|
||||
int town = 0;
|
||||
int area = 0;
|
||||
};
|
||||
|
||||
using MapInfoBody = std::variant<
|
||||
int,
|
||||
std::string,
|
||||
std::map<std::string, bool>,
|
||||
std::vector<BackGroundAni>,
|
||||
std::vector<MapAni>,
|
||||
std::vector<MapNpc>,
|
||||
@@ -66,6 +68,8 @@ public:
|
||||
int _MapHeight = 0;
|
||||
// 可行区域
|
||||
std::vector<SDL_FRect> _MovableArea;
|
||||
// 传送区域
|
||||
std::vector<SDL_FRect> _MoveArea;
|
||||
// 调试模式
|
||||
bool _DebugMode = false;
|
||||
|
||||
@@ -81,17 +85,36 @@ public:
|
||||
GameMap(/* args */);
|
||||
~GameMap();
|
||||
|
||||
/**加载地图 (地图路径) */
|
||||
void LoadMap(std::string mapName);
|
||||
/**进入地图执行的操作 */
|
||||
void Enter();
|
||||
/**重载OnUpdate函数 */
|
||||
void OnUpdate(float deltaTime) override;
|
||||
|
||||
public:
|
||||
/**读取脚本配置 */
|
||||
void InitConfiguration(std::string mapName);
|
||||
/**初始化地板 */
|
||||
void InitTile();
|
||||
/**初始化背景动画 */
|
||||
void InitBackgroundAnimation();
|
||||
/**初始化地图动画 */
|
||||
void InitMapAnimation();
|
||||
/**初始化移动区域 */
|
||||
void InitVirtualMovableArea();
|
||||
void Enter(Scene *scene);
|
||||
void Update(float deltaTime) override;
|
||||
/**初始化传送区域 */
|
||||
void InitMoveArea();
|
||||
/**添加对象 */
|
||||
void AddObject(RefPtr<BaseObject> object);
|
||||
|
||||
public:
|
||||
// 检查是否可移动
|
||||
VecFPos3 CheckIsItMovable(VecFPos3 CurPos, VecFPos3 PosOffset);
|
||||
// 检查是否进入传送区域
|
||||
MapMoveArea CheckIsItMoveArea(VecFPos3 CurPos);
|
||||
/**获取移动区域信息 */
|
||||
std::vector<GameMap::MapMoveArea> &GetMoveAreaInfo();
|
||||
/**获取移动区域坐标信息 */
|
||||
SDL_Rect GetMovablePositionArea(int Index);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user