建档
This commit is contained in:
87
source_game/Actor/Map/GameMap.h
Normal file
87
source_game/Actor/Map/GameMap.h
Normal file
@@ -0,0 +1,87 @@
|
||||
#pragma once
|
||||
#include "Actor/Map/GameMapLayer.h"
|
||||
#include "Asset/Asset_Script.h"
|
||||
#include "Actor/Map/Tile.h"
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <variant>
|
||||
|
||||
class BaseObject;
|
||||
class GameMapCamera;
|
||||
class GameMap
|
||||
{
|
||||
struct BackGroundAni
|
||||
{
|
||||
std::string filename;
|
||||
std::string layer;
|
||||
std::string order;
|
||||
};
|
||||
|
||||
struct MapAni
|
||||
{
|
||||
std::string filename;
|
||||
std::string layer;
|
||||
int XPos;
|
||||
int YPos;
|
||||
int ZPos;
|
||||
};
|
||||
|
||||
struct MapNpc
|
||||
{
|
||||
int id;
|
||||
std::string direction;
|
||||
int XPos;
|
||||
int YPos;
|
||||
int ZPos;
|
||||
};
|
||||
|
||||
struct MapMoveArea
|
||||
{
|
||||
int town;
|
||||
int area;
|
||||
};
|
||||
|
||||
using MapInfoBody = std::variant<
|
||||
int,
|
||||
std::string,
|
||||
std::vector<BackGroundAni>,
|
||||
std::vector<MapAni>,
|
||||
std::vector<MapNpc>,
|
||||
std::vector<MapMoveArea>,
|
||||
std::vector<int>,
|
||||
std::vector<std::string>>;
|
||||
|
||||
public:
|
||||
// 地图信息
|
||||
std::unordered_map<std::string, MapInfoBody> _MapInfo;
|
||||
// 地图路径
|
||||
std::string _MapPath;
|
||||
// 地图文件夹
|
||||
std::string _MapDir;
|
||||
// 地图宽度
|
||||
int _MapLength = 0;
|
||||
// 地图高度
|
||||
int _MapHeight = 0;
|
||||
|
||||
public:
|
||||
// 图层Map 图层类型 显示对象
|
||||
std::unordered_map<std::string, RefPtr<GameMapLayer>> _LayerMap;
|
||||
// 摄像机对象
|
||||
GameMapCamera *_Camera;
|
||||
|
||||
|
||||
public:
|
||||
GameMap(/* args */);
|
||||
~GameMap();
|
||||
|
||||
void LoadMap(std::string mapName);
|
||||
void InitConfiguration(std::string mapName);
|
||||
void InitTile();
|
||||
void InitBackgroundAnimation();
|
||||
void InitMapAnimation();
|
||||
void Enter(Scene *scene);
|
||||
void HandleEvents(SDL_Event *e);
|
||||
void Update(float deltaTime);
|
||||
|
||||
public:
|
||||
};
|
||||
Reference in New Issue
Block a user