merge
This commit is contained in:
commit
cc2eba1352
12 files changed
+79
-32
No files matched your search
+34
-20
@@ -275,14 +275,14 @@ namespace ZL
|
||||
|
||||
dialogueSystem.init(renderer, CONST_ZIP_FILE);
|
||||
dialogueSystem.loadDatabase("resources/dialogue/sample_dialogues.json");
|
||||
dialogueSystem.addTriggerZone({
|
||||
/*dialogueSystem.addTriggerZone({
|
||||
"ghost_room_trigger",
|
||||
"test_line_dialogue",
|
||||
Eigen::Vector3f(0.0f, 0.0f, -8.5f),
|
||||
2.0f,
|
||||
true,
|
||||
false
|
||||
});
|
||||
});*/
|
||||
|
||||
scriptEngine.init(this);
|
||||
|
||||
@@ -773,7 +773,11 @@ namespace ZL
|
||||
|
||||
lastTickCount = newTickCount;
|
||||
|
||||
if (player) player->update(delta);
|
||||
//if (player) player->update(delta);
|
||||
if (player) {
|
||||
player->update(delta);
|
||||
dialogueSystem.update(static_cast<int>(delta), player->position);
|
||||
}
|
||||
for (auto& npc : npcs) npc->update(delta);
|
||||
|
||||
|
||||
@@ -806,9 +810,9 @@ namespace ZL
|
||||
}
|
||||
|
||||
//for (auto& npc : npcs) npc->update(delta);
|
||||
if (player) {
|
||||
dialogueSystem.update(static_cast<int>(delta), player->position);
|
||||
}
|
||||
//if (player) {
|
||||
// dialogueSystem.update(static_cast<int>(delta), player->position);
|
||||
//}
|
||||
}
|
||||
|
||||
// Some AI stuff
|
||||
@@ -904,6 +908,10 @@ namespace ZL
|
||||
handleDown(ZL::UiManager::MOUSE_FINGER_ID, mx, my);
|
||||
|
||||
player->attackTarget = nullptr;
|
||||
if (menuManager.uiManager.isUiInteractionForFinger(ZL::UiManager::MOUSE_FINGER_ID)) {
|
||||
std::cout << "[CLICK] UI handled, skipping character movement" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Calculate ray for picking
|
||||
if (dialogueSystem.blocksGameplayInput()) {
|
||||
@@ -948,22 +956,28 @@ namespace ZL
|
||||
// Check if we clicked on an NPC
|
||||
Character* clickedNpc = raycastNpcs(camPos, rayDir);
|
||||
if (clickedNpc && player) {
|
||||
int npcIndex = -1;
|
||||
for (size_t i = 0; i < npcs.size(); ++i) {
|
||||
if (npcs[i].get() == clickedNpc) {
|
||||
npcIndex = static_cast<int>(i);
|
||||
break;
|
||||
float distance = (player->position - clickedNpc->position).norm();
|
||||
if (distance <= clickedNpc->interactionRadius) {
|
||||
int npcIndex = -1;
|
||||
for (size_t i = 0; i < npcs.size(); ++i) {
|
||||
if (npcs[i].get() == clickedNpc) {
|
||||
npcIndex = static_cast<int>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (npcIndex != -1) {
|
||||
std::cout << "[CLICK] *** SUCCESS: Clicked on NPC index: " << npcIndex << " ***" << std::endl;
|
||||
scriptEngine.callNpcInteractCallback(npcIndex);
|
||||
|
||||
if (clickedNpc->canAttack)
|
||||
{
|
||||
player->attackTarget = clickedNpc;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (npcIndex != -1) {
|
||||
std::cout << "[CLICK] *** SUCCESS: Clicked on NPC index: " << npcIndex << " ***" << std::endl;
|
||||
scriptEngine.callNpcInteractCallback(npcIndex);
|
||||
|
||||
if (clickedNpc->canAttack)
|
||||
{
|
||||
player->attackTarget = clickedNpc;
|
||||
}
|
||||
|
||||
else {
|
||||
std::cout << "[CLICK] Too far from NPC (distance " << distance
|
||||
<< " > " << clickedNpc->interactionRadius << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
else if (rayDir.y() < -0.001f && player) {
|
||||
|
||||
Reference in new issue
Block a user