added dialog start radius and background by time in cutscenes
This commit is contained in:
1 parent
db8b9b7a18
commit
f7e6f063d1
10 files changed
+35
-10
No files matched your search
+15
-8
@@ -656,16 +656,23 @@ 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] NPC interaction (distance " << distance << ")" << std::endl;
|
||||
scriptEngine.callNpcInteractCallback(npcIndex);
|
||||
}
|
||||
}
|
||||
if (npcIndex != -1) {
|
||||
std::cout << "[CLICK] *** SUCCESS: Clicked on NPC index: " << npcIndex << " ***" << std::endl;
|
||||
scriptEngine.callNpcInteractCallback(npcIndex);
|
||||
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