/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* multiLocalGamePage.js :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: edbernar { if (e.key == 'a') Map.reCreate(true); }) renderer.setAnimationLoop(loop); document.body.style.opacity = 1; } static dispose() { Map.dispose(); if (renderer) renderer.dispose(); renderer = null; camera = null; if (scene) { scene.children.forEach(child => { if (child.geometry) child.geometry.dispose(); if (child.material) child.material.dispose(); if (child.texture) child.texture.dispose(); scene.remove(child); }); } scene = null; } }; function loop() { if (gameEndStatus) { renderer.setAnimationLoop(null); gameFinish() } Ball.update(); Map.update(); Players.update(); if (renderer) renderer.render(scene, camera); } function gameFinish() { scoreElement.innerHTML = "Player " + (score.player1 > score.player2 ? "1" : "2") + " win !"; scoreElement.style.fontSize = '10vh'; scoreElement.style.opacity = 1; document.body.style.animation = 'none'; setTimeout(() => { document.body.style.animation = 'end 1s'; setTimeout(() => { pageRenderer.changePage('lobbyPage'); }, 500); }, 3000); } export { multiLocalGamePage };