import * as RE from 'rogue-engine'; import * as THREE from 'three'; import RaycastReceiver from './RaycastReceiver.re'; export default class BallRaycastReceiver extends RaycastReceiver { originalMaterial: THREE.Material @RE.props.material() highlightMaterial: THREE.Material; awake() { } start() { if (!this.highlightMaterial) { RE.Debug.logError("BallRaycastReceiver has no highlight material set") } } update() { } onMouseOver(intersect): boolean { var currentObj = intersect.object this.originalMaterial = currentObj.material if (this.highlightMaterial) { currentObj.material = this.highlightMaterial } RE.Runtime.rogueDOMContainer.style.cursor = "pointer" return true } onMouseOut(): boolean { (this.object3d as any).material = this.originalMaterial RE.Runtime.rogueDOMContainer.style.cursor = "default" return true } } RE.registerComponent(BallRaycastReceiver);