mini games

This commit is contained in:
2025-07-01 10:21:18 +03:00
parent 03281ee582
commit bc800182e2
10 changed files with 211 additions and 16 deletions
+23 -7
View File
@@ -53,6 +53,9 @@
import { GameEngine } from '@/lib/GameEngine';
import { Hero } from '@/lib/Hero';
import { Game1 } from '@/lib/mini-games/Game1';
import { Game2 } from '@/lib/mini-games/Game2';
import { Game4 } from '@/lib/mini-games/Game4';
import { useAppStore } from '@/stores/app';
const store = useAppStore();
@@ -181,6 +184,18 @@ export default {
// gameEngine.camera.rotation.copy(l.camera.position)
// gameEngine.camera.scale.copy(l.camera.position)
}
// let testGame1 = new Game1(gameEngine, '/static/textures/game1-test.jpg', 2, 3);
// gameEngine.activeObjects.add(testGame1.game);
// testGame1.game.position.set(0, 1, -5);
// let testGame2 = new Game2(gameEngine, '/static/textures/game2-test.jpg', 3, 3);
// gameEngine.activeObjects.add(testGame2.game);
// testGame2.game.position.set(0, 1, 5);
// let testGame4 = new Game4(gameEngine, '/static/feathers-game.glb', 3, 4);
// gameEngine.activeObjects.add(testGame4.game);
// testGame4.game.position.set(0, 1, 5);
},
async expandScenarioData(scene){
scene.data.$environment = (await this.$api.gameObject.load(scene.data.environment)).data
@@ -192,15 +207,16 @@ export default {
this.pointerDownTime = performance.now();
},
targetClick(e){
if (performance.now() - this.pointerDownTime < 200){
let intersects = gameEngine.intersect(e, this.$refs.target, gameEngine.activeObjects.children, true);
//console.log(intersects)
if (intersects.length){
// if (performance.now() - this.pointerDownTime < 200){
// let intersects = gameEngine.intersect(e, this.$refs.target, gameEngine.activeObjects.children, true);
// //console.log(intersects)
// if (intersects.length){
}else{
// }else{
}
}
// }
// }
gameEngine.onClick(e, this.$refs.target);
},
setObjectAttributes(l, data, o, autoScaleFactor = 1){
if (l[data.id]){