ContinueReceiver.re.js 830 B

123456789101112131415161718192021222324252627282930
  1. import * as RE from 'rogue-engine';
  2. import RaycastReceiver from '../RaycastReceiver.re';
  3. export default class ContinueReceiver extends RaycastReceiver {
  4. onMouseOver(intersect) {
  5. this.isHovering = true
  6. this.object3d.currentObj = intersect.object
  7. this.object3d.currentObj.material.color.set(0xff0000)
  8. RE.Runtime.rogueDOMContainer.style.cursor = "pointer"
  9. }
  10. onMouseOut(){
  11. this.isHovering = false
  12. this.object3d.currentObj.material.color.set(0xffffff)
  13. RE.Runtime.rogueDOMContainer.style.cursor = "default"
  14. }
  15. update() {
  16. if(!this.isHovering) {
  17. return
  18. }
  19. if(RE.Input.mouse.getButtonUp(0) || RE.Input.touch.endTouches.length > 0) {
  20. RE.Runtime.rogueDOMContainer.style.cursor = "default"
  21. RE.App.loadScene("Main")
  22. }
  23. }
  24. }
  25. RE.registerComponent(ContinueReceiver);