Browse Source

interact prompt

master
cailean 2 hours ago
parent
commit
972a165087
  1. 116
      js/Player.js

116
js/Player.js

@ -979,64 +979,64 @@ 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();
// this.interactPrompt.userData.charMeshes.forEach((mesh, i) => { this.interactPrompt.userData.charMeshes.forEach((mesh, i) => {
// // Don't animate spaces // Don't animate spaces
// if (mesh.material.map.image) { if (mesh.material.map.image) {
// const ctx = mesh.material.map.image.getContext && mesh.material.map.image.getContext('2d'); const ctx = mesh.material.map.image.getContext && mesh.material.map.image.getContext('2d');
// if (ctx && ctx.measureText && ctx.measureText(' ').width === 0) return; if (ctx && ctx.measureText && ctx.measureText(' ').width === 0) return;
// } }
// // Snap rotation at random intervals // Snap rotation at random intervals
// if (now > mesh.userData.nextSnap) { if (now > mesh.userData.nextSnap) {
// mesh.userData.snapRotation = (Math.random() * 40 - 20) * Math.PI / 180; // -20 to +20 deg in radians mesh.userData.snapRotation = (Math.random() * 40 - 20) * Math.PI / 180; // -20 to +20 deg in radians
// mesh.userData.nextSnap = now + Math.random() * 600 + 300; // 100-700ms mesh.userData.nextSnap = now + Math.random() * 600 + 300; // 100-700ms
// } }
// mesh.rotation.z = mesh.userData.snapRotation; mesh.rotation.z = mesh.userData.snapRotation;
// }); });
// } }
// --- Item Counter Animation --- // --- Item Counter Animation ---
if (this.itemCountDisplay && this.itemCountAnim.active) { if (this.itemCountDisplay && this.itemCountAnim.active) {

Loading…
Cancel
Save