Browse Source

remove interact prompt

master
cailean 2 hours ago
parent
commit
9c5e135e22
  1. 76
      js/Player.js

76
js/Player.js

@ -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 // // Show prompt if hovering over item and not holding one
if (this.currentIntItem && !this.attachedItem) { // if (this.currentIntItem && !this.attachedItem) {
// Regenerate prompt if hovered item changed // // Regenerate prompt if hovered item changed
if (this.lastPromptItem !== this.currentIntItem) { // if (this.lastPromptItem !== this.currentIntItem) {
// Remove old prompt mesh // // Remove old prompt mesh
this.camera.remove(this.interactPrompt); // this.camera.remove(this.interactPrompt);
// Dispose all character meshes in the group // // Dispose all character meshes in the group
if (this.interactPrompt.userData.charMeshes) { // if (this.interactPrompt.userData.charMeshes) {
this.interactPrompt.userData.charMeshes.forEach(mesh => { // this.interactPrompt.userData.charMeshes.forEach(mesh => {
if (mesh.geometry) mesh.geometry.dispose(); // if (mesh.geometry) mesh.geometry.dispose();
if (mesh.material) { // if (mesh.material) {
if (mesh.material.map) mesh.material.map.dispose(); // if (mesh.material.map) mesh.material.map.dispose();
mesh.material.dispose(); // mesh.material.dispose();
} // }
}); // });
} // }
// Create new prompt with new random colors // // Create new prompt with new random colors
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 = true; // this.interactPrompt.visible = true;
this.interactPromptTime += delta; // this.interactPromptTime += delta;
const bob = Math.sin(this.interactPromptTime * 2) * 0.01; // const bob = Math.sin(this.interactPromptTime * 2) * 0.01;
this.interactPrompt.position.y = -0.5 + bob; // this.interactPrompt.position.y = -0.5 + bob;
this.lastPromptItem = this.currentIntItem; // this.lastPromptItem = this.currentIntItem;
} else { // } else {
this.interactPrompt.visible = false; // this.interactPrompt.visible = false;
this.interactPromptTime = 0; // this.interactPromptTime = 0;
this.lastPromptItem = null; // 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();

Loading…
Cancel
Save