Hi all,
I am running the following code block on this project:
import * as ecs from '@8thwall/ecs'
ecs.registerComponent({
name: 'startScreen',
schema: {
loadingUI: ecs.eid,
onboardingUI: ecs.eid,
startButton: ecs.eid,
startButtonText: ecs.eid,
},
schemaDefaults: {
},
data: {
},
stateMachine: ({world, eid, schemaAttribute}) => {
const startGame = ecs.defineTrigger()
const {
loadingUI,
onboardingUI,
startButton,
startButtonText,
} = schemaAttribute.get(eid)
const handleStart = () => {
console.info('handleStart')
ecs.ScaleAnimation.set(world, startButton, {
autoFrom: true,
toX: 0,
toY: 0,
toZ: 0,
loop: false,
duration: 1000,
easeOut: true,
easingFunction: 'Elastic',
})
setTimeout(() => {
ecs.Hidden.set(world, onboardingUI, {})
startGame.trigger()
}, 1000)
console.info('handleStart')
}
ecs.defineState('onboarding')
.onEnter(() => {
ecs.Ui.mutate(world, startButtonText, (cursor) => {
cursor.text = 'loading'
})
const onxrloaded = () => {
ecs.Ui.mutate(world, startButtonText, (cursor) => {
cursor.text = 'start'
})
world.events.addListener(startButton, ecs.input.SCREEN_TOUCH_START, handleStart)
}
window.XR8 ? onxrloaded() : window.addEventListener('xrloaded', onxrloaded)
})
.onExit(() => {
world.events.removeListener(startButton, ecs.input.SCREEN_TOUCH_START, handleStart)
world.deleteEntity(onboardingUI)
})
.initial()
.onTrigger(startGame, 'gameStarted')
},
add: (world, component) => {
ecs.Ui.set(world, component.schema.loadingUI, {
width: window.innerWidth, height: window.innerHeight,
})
},
})
The start UI boots up and shows, however no touch event will trigger the animation. Iβm not convinced this is a code issue as Iβm following along with a this sample project. The gist is that the SCREEN_TOUCH_START
event doesnβt seem to be occuring when the component is touched. Any help would be massively appreciated!