added load npcs from json
This commit is contained in:
1 parent
b3fda88784
commit
943b6b4d21
6 files changed
+208
-4
No files matched your search
@@ -6,12 +6,13 @@
|
||||
#include "external/nlohmann/json.hpp"
|
||||
#include "TextModel.h"
|
||||
#include "InteractiveObject.h"
|
||||
|
||||
#include "Character.h"
|
||||
namespace ZL {
|
||||
|
||||
struct Texture;
|
||||
struct VertexRenderStruct;
|
||||
class Renderer;
|
||||
class Character;
|
||||
|
||||
struct GameObjectData {
|
||||
std::string name;
|
||||
@@ -32,6 +33,23 @@ namespace ZL {
|
||||
float interactionRadius = 2.0f;
|
||||
};
|
||||
|
||||
struct NpcData {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::string texturePath;
|
||||
std::string animationIdlePath;
|
||||
std::string animationWalkPath;
|
||||
float positionX = 0.0f;
|
||||
float positionY = 0.0f;
|
||||
float positionZ = 0.0f;
|
||||
float walkSpeed = 1.5f;
|
||||
float rotationSpeed = 8.0f;
|
||||
float modelScale = 0.01f;
|
||||
float modelCorrectionRotX = 0.0f;
|
||||
float modelCorrectionRotY = 0.0f;
|
||||
float modelCorrectionRotZ = 0.0f;
|
||||
};
|
||||
|
||||
struct LoadedGameObject {
|
||||
std::shared_ptr<Texture> texture;
|
||||
VertexRenderStruct mesh;
|
||||
@@ -53,6 +71,13 @@ namespace ZL {
|
||||
Renderer& renderer,
|
||||
const std::string& zipPath = ""
|
||||
);
|
||||
|
||||
static std::vector<std::unique_ptr<Character>> loadAndCreateNpcs(
|
||||
const std::string& jsonPath,
|
||||
const std::string& zipPath = ""
|
||||
);
|
||||
|
||||
static std::vector<NpcData> loadNpcsFromJson(const std::string& jsonPath, const std::string& zipPath = "");
|
||||
};
|
||||
|
||||
} // namespace ZL
|
||||
Reference in new issue
Block a user