Working on teleports
This commit is contained in:
1 parent
7e94009217
commit
8214342248
15 files changed
+298
-131
No files matched your search
+6
-10
@@ -12,6 +12,7 @@
|
||||
#include "ScriptEngine.h"
|
||||
#include "dialogue/DialogueSystem.h"
|
||||
#include "SparkEmitter.h"
|
||||
#include "TeleportZone.h"
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
@@ -27,9 +28,8 @@ namespace ZL
|
||||
std::string dialoguesJsonPath;
|
||||
std::string navigationJsonPath;
|
||||
std::string scriptPath;
|
||||
std::string teleportsJsonPath;
|
||||
Eigen::Vector3f playerPosition = Eigen::Vector3f::Zero();
|
||||
Eigen::Vector3f teleportPosition = Eigen::Vector3f::Zero();
|
||||
float teleportRadius = 0.0f;
|
||||
};
|
||||
|
||||
class Location
|
||||
@@ -69,14 +69,9 @@ namespace ZL
|
||||
ScriptEngine scriptEngine;
|
||||
Dialogue::DialogueSystem dialogueSystem;
|
||||
|
||||
// Teleport zone: when the player crosses into the radius of teleportPosition,
|
||||
// onTeleport() is invoked once. Re-triggering requires leaving the zone first
|
||||
// (rising-edge detection via playerInTeleportZone).
|
||||
Eigen::Vector3f teleportPosition = Eigen::Vector3f::Zero();
|
||||
float teleportRadius = 0.0f;
|
||||
bool playerInTeleportZone = false;
|
||||
std::function<void()> onTeleport;
|
||||
std::unique_ptr<SparkEmitter> teleportSparks;
|
||||
std::vector<TeleportZone> teleportZones;
|
||||
TeleportZone* targetTeleportZone = nullptr;
|
||||
std::function<void(const std::string&, const Eigen::Vector3f&, float)> onTeleport;
|
||||
|
||||
#ifdef SHOW_PATH
|
||||
std::vector<VertexRenderStruct> debugNavMeshes;
|
||||
@@ -118,6 +113,7 @@ namespace ZL
|
||||
private:
|
||||
void resolveCharacterCollisions();
|
||||
void updateDynamicReplans(int64_t deltaMs);
|
||||
void loadTeleportZones(const std::string& jsonPath, const char* zipFile);
|
||||
|
||||
std::unordered_map<Character*, Eigen::Vector3f> lastCharacterPositions;
|
||||
std::unordered_map<Character*, int64_t> replanCooldownRemainingMs;
|
||||
|
||||
Reference in new issue
Block a user