|
|
@ -979,47 +979,47 @@ export class Player { |
|
|
this._checkAreaTriggers(); |
|
|
this._checkAreaTriggers(); |
|
|
|
|
|
|
|
|
// --- Interact Prompt Logic ---
|
|
|
// --- Interact Prompt Logic ---
|
|
|
if (!this.interactPrompt) { |
|
|
// if (!this.interactPrompt) {
|
|
|
this.interactPrompt = this._createInteractPrompt(); |
|
|
// this.interactPrompt = this._createInteractPrompt();
|
|
|
this.camera.add(this.interactPrompt); |
|
|
// this.camera.add(this.interactPrompt);
|
|
|
this.interactPrompt.position.set(0, -0.5, -2); |
|
|
// this.interactPrompt.position.set(0, -0.5, -2);
|
|
|
this.interactPrompt.visible = false; |
|
|
// this.interactPrompt.visible = false;
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
// Show prompt if hovering over item and not holding one
|
|
|
|
|
|
if (this.currentIntItem && !this.attachedItem) { |
|
|
|
|
|
// Regenerate prompt if hovered item changed
|
|
|
|
|
|
if (this.lastPromptItem !== this.currentIntItem) { |
|
|
|
|
|
// Remove old prompt mesh
|
|
|
|
|
|
this.camera.remove(this.interactPrompt); |
|
|
|
|
|
|
|
|
|
|
|
// Dispose all character meshes in the group
|
|
|
|
|
|
if (this.interactPrompt.userData.charMeshes) { |
|
|
|
|
|
this.interactPrompt.userData.charMeshes.forEach(mesh => { |
|
|
|
|
|
if (mesh.geometry) mesh.geometry.dispose(); |
|
|
|
|
|
if (mesh.material) { |
|
|
|
|
|
if (mesh.material.map) mesh.material.map.dispose(); |
|
|
|
|
|
mesh.material.dispose(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Create new prompt with new random colors
|
|
|
// // Show prompt if hovering over item and not holding one
|
|
|
this.interactPrompt = this._createInteractPrompt(); |
|
|
// if (this.currentIntItem && !this.attachedItem) {
|
|
|
this.camera.add(this.interactPrompt); |
|
|
// // Regenerate prompt if hovered item changed
|
|
|
this.interactPrompt.position.set(0, -0.5, -2); |
|
|
// if (this.lastPromptItem !== this.currentIntItem) {
|
|
|
} |
|
|
// // Remove old prompt mesh
|
|
|
|
|
|
// this.camera.remove(this.interactPrompt);
|
|
|
|
|
|
|
|
|
|
|
|
// // Dispose all character meshes in the group
|
|
|
|
|
|
// if (this.interactPrompt.userData.charMeshes) {
|
|
|
|
|
|
// this.interactPrompt.userData.charMeshes.forEach(mesh => {
|
|
|
|
|
|
// if (mesh.geometry) mesh.geometry.dispose();
|
|
|
|
|
|
// if (mesh.material) {
|
|
|
|
|
|
// if (mesh.material.map) mesh.material.map.dispose();
|
|
|
|
|
|
// mesh.material.dispose();
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
this.interactPrompt.visible = true; |
|
|
// // Create new prompt with new random colors
|
|
|
this.interactPromptTime += delta; |
|
|
// this.interactPrompt = this._createInteractPrompt();
|
|
|
const bob = Math.sin(this.interactPromptTime * 2) * 0.01; |
|
|
// this.camera.add(this.interactPrompt);
|
|
|
this.interactPrompt.position.y = -0.5 + bob; |
|
|
// this.interactPrompt.position.set(0, -0.5, -2);
|
|
|
this.lastPromptItem = this.currentIntItem; |
|
|
// }
|
|
|
} else { |
|
|
|
|
|
this.interactPrompt.visible = false; |
|
|
// this.interactPrompt.visible = true;
|
|
|
this.interactPromptTime = 0; |
|
|
// this.interactPromptTime += delta;
|
|
|
this.lastPromptItem = null; |
|
|
// const bob = Math.sin(this.interactPromptTime * 2) * 0.01;
|
|
|
} |
|
|
// this.interactPrompt.position.y = -0.5 + bob;
|
|
|
|
|
|
// this.lastPromptItem = this.currentIntItem;
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// this.interactPrompt.visible = false;
|
|
|
|
|
|
// this.interactPromptTime = 0;
|
|
|
|
|
|
// this.lastPromptItem = null;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
// if (this.interactPrompt && this.interactPrompt.userData.charMeshes) {
|
|
|
// if (this.interactPrompt && this.interactPrompt.userData.charMeshes) {
|
|
|
// const now = performance.now();
|
|
|
// const now = performance.now();
|
|
|
|