Game
- Add changeBarColor - Add changePlane (all in multi)
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */
|
||||
/* Updated: 2024/09/10 17:16:22 by hubourge ### ########.fr */
|
||||
/* Updated: 2024/09/10 18:32:10 by hubourge ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -174,6 +174,11 @@ function createBarPlayer(color)
|
||||
return (mesh);
|
||||
}
|
||||
|
||||
function changeBarColor(bar, color)
|
||||
{
|
||||
bar.material.color.set(color);
|
||||
}
|
||||
|
||||
function loop()
|
||||
{
|
||||
stats.begin();
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/20 14:52:55 by hubourge #+# #+# */
|
||||
/* Updated: 2024/08/29 17:52:41 by hubourge ### ########.fr */
|
||||
/* Updated: 2024/09/10 18:27:01 by hubourge ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -64,7 +64,6 @@ class Map
|
||||
|
||||
dispose()
|
||||
{
|
||||
|
||||
videoList.forEach(elem => {
|
||||
elem.video.pause();
|
||||
elem.video.src = '';
|
||||
@ -161,6 +160,27 @@ class Map
|
||||
return (meshPlane);
|
||||
};
|
||||
|
||||
changePlane(texture)
|
||||
{
|
||||
console.log(this.arrObject);
|
||||
for (let i = 0; i < this.arrObject.length; i++)
|
||||
{
|
||||
if (this.arrObject[i].name == "planeBottom" || this.arrObject[i].name == "planeTop")
|
||||
{
|
||||
if (this.arrObject[i].mesh.material)
|
||||
this.arrObject[i].mesh.material.dispose();
|
||||
if (typeof(texture) == 'string')
|
||||
{
|
||||
let textureLoader = new THREE.TextureLoader();
|
||||
texture = textureLoader.load(texture);
|
||||
this.arrObject[i].mesh.material.map = texture;
|
||||
}
|
||||
else if (typeof(texture) == 'number')
|
||||
this.arrObject[i].mesh.material.color.set(texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#createWall(x, y, z, name)
|
||||
{
|
||||
let geometryWall = null;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/28 12:23:48 by edbernar #+# #+# */
|
||||
/* Updated: 2024/09/10 17:16:43 by hubourge ### ########.fr */
|
||||
/* Updated: 2024/09/10 18:13:14 by hubourge ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -45,7 +45,7 @@ class Map
|
||||
world = new CANNON.World({
|
||||
gravity: new CANNON.Vec3(0, -9.81, 0),
|
||||
});
|
||||
ground = createGround(scene, '/textures/pastel.jpg');
|
||||
ground = createGround(scene, 0x222222);
|
||||
wallBottom = createWall(false);
|
||||
wallTop = createWall(true);
|
||||
spotLight = new THREE.SpotLight({color: 0xffffff});
|
||||
|
Reference in New Issue
Block a user