From 3e0d6edbce351ed0e4ea7da1e12a847e90706da4 Mon Sep 17 00:00:00 2001
From: LJ5O <75009579+LJ5O@users.noreply.github.com>
Date: Sun, 28 Jan 2024 15:54:12 +0100
Subject: [PATCH] New addLinkPlate function
It's now easier to add a linkPlate
---
src/utils/addAssetsOnScene.js | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/utils/addAssetsOnScene.js b/src/utils/addAssetsOnScene.js
index e0eee3c..80efa8a 100644
--- a/src/utils/addAssetsOnScene.js
+++ b/src/utils/addAssetsOnScene.js
@@ -405,6 +405,21 @@ export async function addAssetsOnScene(scene){
plates.push(zoomPlateClone);
}
+ function addLinkPlate(x, y, link){
+ //Function used to add easily a link plate in the scene
+ const linkPlateClone = linkPlate.scene.clone();
+ linkPlateClone.position.y = y;
+ linkPlateClone.position.x = x;
+
+ scene.add( linkPlateClone );
+
+ linkPlateClone.onEnterHitbox = ()=>{Notifications.showNotification("Vous pouvez ouvrir ce lien avec la touche Entrée, ou en cliquant ici !",
+ ()=>{Notifications.openLink(link)} )};
+ linkPlateClone.onLeaveHitbox = ()=>{Notifications.hideNotification()};
+
+ plates.push(linkPlateClone);
+ }
+
/* --------------------
ADDING SIGNS
-------------------- */
@@ -469,15 +484,7 @@ export async function addAssetsOnScene(scene){
scene.add(signPlane);
//ADDING LINK PLATES
- const linkPlateClone = linkPlate.scene.clone();
- linkPlateClone.position.y = 0.5;
- linkPlateClone.position.x = -20.3 + i*5;
-
- scene.add( linkPlateClone );
- linkPlateClone.onEnterHitbox = ()=>{Notifications.showNotification("Vous pouvez ouvrir ce lien avec la touche Entrée, ou en cliquant ici !",
- ()=>{Notifications.openLink(notificationsLinks[i])} )};
- linkPlateClone.onLeaveHitbox = ()=>{Notifications.hideNotification()};
- plates.push(linkPlateClone);
+ addLinkPlate(-20.3 + i*5, 0.5, notificationsLinks[i]);
}