|
|
@ -16,6 +16,8 @@ |
|
|
|
/* TODO : |
|
|
|
/* TODO : |
|
|
|
- refactor to use emit('eventname', {eventdata:'data'}) for onreleased and onpicked rather than latest element |
|
|
|
- refactor to use emit('eventname', {eventdata:'data'}) for onreleased and onpicked rather than latest element |
|
|
|
e.g newEl.setAttribute("onreleased", 'document.querySelector("['+generatorName+']").emit("check",{color:"'+color+'"})') |
|
|
|
e.g newEl.setAttribute("onreleased", 'document.querySelector("['+generatorName+']").emit("check",{color:"'+color+'"})') |
|
|
|
|
|
|
|
let latest = selectedElements[selectedElements.length-1].element |
|
|
|
|
|
|
|
check for this pattern and replace by event.detail.element instead |
|
|
|
- insure scene setup, e.g starting position and orientation of environment and main character (until now assumed unchanged) |
|
|
|
- insure scene setup, e.g starting position and orientation of environment and main character (until now assumed unchanged) |
|
|
|
- isolate emit('eventname', {test:0}) versus same with onreleased (which does NOT work) and same without event detail (which works) |
|
|
|
- isolate emit('eventname', {test:0}) versus same with onreleased (which does NOT work) and same without event detail (which works) |
|
|
|
- add audio instructions |
|
|
|
- add audio instructions |
|
|
@ -52,8 +54,8 @@ AFRAME.registerComponent('startfunctions', { |
|
|
|
let newEl = document.createElement('a-entity') |
|
|
|
let newEl = document.createElement('a-entity') |
|
|
|
//let gamename = "checkers" |
|
|
|
//let gamename = "checkers" |
|
|
|
//let gamename = "carcassone" |
|
|
|
//let gamename = "carcassone" |
|
|
|
let gamename = "simon" |
|
|
|
//let gamename = "simon" |
|
|
|
//let gamename = "voxelpaint" |
|
|
|
let gamename = "voxelpaint" |
|
|
|
newEl.id = gamename |
|
|
|
newEl.id = gamename |
|
|
|
newEl.setAttribute(gamename, "") |
|
|
|
newEl.setAttribute(gamename, "") |
|
|
|
newEl.classList.add( "game" ) |
|
|
|
newEl.classList.add( "game" ) |
|
|
@ -168,8 +170,8 @@ AFRAME.registerComponent('voxelpaint', { |
|
|
|
let poses = [] |
|
|
|
let poses = [] |
|
|
|
Array.from( this.el.querySelectorAll(".voxel") ).map( el => { |
|
|
|
Array.from( this.el.querySelectorAll(".voxel") ).map( el => { |
|
|
|
poses.push( { |
|
|
|
poses.push( { |
|
|
|
position: el.getAttribute("position"), |
|
|
|
position: this.shortenVector3( el.getAttribute("position") ), |
|
|
|
rotation: el.getAttribute("rotation"), |
|
|
|
rotation: this.shortenVector3( el.getAttribute("rotation") ), |
|
|
|
color: el.getAttribute("color") |
|
|
|
color: el.getAttribute("color") |
|
|
|
} ) |
|
|
|
} ) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -178,6 +180,13 @@ AFRAME.registerComponent('voxelpaint', { |
|
|
|
window.location.hash = JSON.stringify(data) |
|
|
|
window.location.hash = JSON.stringify(data) |
|
|
|
// prefixed by generatorName in order to support saving/sharing of the state of other games |
|
|
|
// prefixed by generatorName in order to support saving/sharing of the state of other games |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
shortenVector3: function ( v ){ |
|
|
|
|
|
|
|
let o = new THREE.Vector3() |
|
|
|
|
|
|
|
o.x = v.x.toFixed(3) |
|
|
|
|
|
|
|
o.y = v.y.toFixed(3) |
|
|
|
|
|
|
|
o.z = v.z.toFixed(3) |
|
|
|
|
|
|
|
return o |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|