(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("rogue-engine"), require("three")); else if(typeof define === 'function' && define.amd) define(["rogue-engine", "three"], factory); else if(typeof exports === 'object') exports["rogue-engine-user-scripts"] = factory(require("rogue-engine"), require("three")); else root["rogue-engine-user-scripts"] = factory(root["rogue-engine"], root["three"]); })(self, function(__WEBPACK_EXTERNAL_MODULE_rogue_engine__, __WEBPACK_EXTERNAL_MODULE_three__) { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./Assets/Components/CombatLogic.re.js": /*!*********************************************!*\ !*** ./Assets/Components/CombatLogic.re.js ***! \*********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ CombatLogic) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Library/SimpleTweens */ "./Assets/Components/Library/SimpleTweens.js"); /* harmony import */ var _TileRaycastReceiver_re__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TileRaycastReceiver.re */ "./Assets/Components/TileRaycastReceiver.re.js"); /* harmony import */ var _Library_Easings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Library/Easings */ "./Assets/Components/Library/Easings.js"); /* harmony import */ var _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Library/AsyncLoader */ "./Assets/Components/Library/AsyncLoader.js"); /* harmony import */ var _Pathway_re__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Pathway.re */ "./Assets/Components/Pathway.re.js"); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class CombatLogic extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.tileMaterials = []; this.boardDimensions = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(8, 8); this.maxColors = 5; this.tweenManager = new _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__.TweenManager(); this.loader = new _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_5__["default"](); this.selectedTiles = []; this.movesRemaining = 8; this.score = 0; } awake() { this.tweenManager.awake(); } start() { for (let child of this.playGrid.children) { this.playGrid.remove(child); } for (let i = 0; i < this.boardDimensions.x * this.boardDimensions.y; i++) { let position = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(i % this.boardDimensions.x, Math.floor(i / this.boardDimensions.x)); this.instantiateTile(position, Math.floor(1500 * Math.random()) + 1800); } this.tweenManager.start(); } instantiateTile(gridPosition, delay, startingY = 14, easingFunction = _Library_Easings__WEBPACK_IMPORTED_MODULE_4__["default"].Elastic.EaseOut) { let tile = this.tile.instantiate(this.playGrid); let component = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_TileRaycastReceiver_re__WEBPACK_IMPORTED_MODULE_3__["default"], tile); component.initialize(gridPosition, this.boardDimensions, this.tileMaterials[Math.floor(Math.random() * Math.min(this.maxColors, this.tileMaterials.length))], this.hoverMaterial, this.tweenManager, delay, startingY, easingFunction); } update() { this.tweenManager.update(); if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonUp(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.endTouches.length > 0) { let pathway = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_Pathway_re__WEBPACK_IMPORTED_MODULE_6__["default"], this.playGrid); if (pathway) { pathway.clearPoints(); } if (this.selectedTiles.length == 1) { this.selectedTiles.length = 0; } if (this.selectedTiles.length > 1 && this.selectedTiles.length < 5) { this.movesRemaining--; } if (this.selectedTiles.length >= 5) { this.movesRemaining += Math.floor((this.selectedTiles.length - 5) / 3); } let moveScore = this.selectedTiles.length * 10; this.selectedTiles.forEach((tileComponent) => { moveScore *= Math.max(1, Math.floor(this.selectedTiles.indexOf(tileComponent) / 5)); tileComponent.remove(this.tweenManager); this.instantiateTile(tileComponent.object3d.gridPosition, Math.floor(1500 * Math.random()) + 300, 14, _Library_Easings__WEBPACK_IMPORTED_MODULE_4__["default"].Exponential.EaseOut); }); this.selectedTiles.length = 0; this.score += moveScore; } if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.keyboard.getKeyUp("Escape")) { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene("Main Menu"); } if (this.movesRemaining == 0) { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene("World Map"); } } addTile(tileComponent) { let isAdded = false; if (this.isStepBack(tileComponent)) { this.selectedTiles.pop(tileComponent); } else if (this.isValidTileToSelect(tileComponent)) { this.selectedTiles.push(tileComponent); isAdded = true; } let pathway = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_Pathway_re__WEBPACK_IMPORTED_MODULE_6__["default"], this.playGrid); if (pathway) { pathway.recomputePath(this.selectedTiles); } return [isAdded, this.selectedTiles]; } isValidTileToSelect(tileComponent) { if (this.selectedTiles.length == 0) { return true; } let lastAddedTile = this.selectedTiles[this.selectedTiles.length - 1]; let initialColor = lastAddedTile.getOriginalMaterial().name; return this.selectedTiles.indexOf(tileComponent) == -1 && tileComponent.getOriginalMaterial().name == initialColor && this.isNearbyTile(lastAddedTile.object3d.gridPosition, tileComponent.object3d.gridPosition); } isNearbyTile(startingPosition, newPosition) { return (newPosition.x == startingPosition.x - 1 || newPosition.x == startingPosition.x || newPosition.x == startingPosition.x + 1) && (newPosition.y == startingPosition.y - 1 || newPosition.y == startingPosition.y || newPosition.y == startingPosition.y + 1); } isStepBack(tileComponent) { return this.selectedTiles.length > 1 && this.selectedTiles.indexOf(tileComponent) == this.selectedTiles.length - 2; } } __name(CombatLogic, "CombatLogic"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D") ], CombatLogic.prototype, "playGrid", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Prefab") ], CombatLogic.prototype, "tile", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Material") ], CombatLogic.prototype, "hoverMaterial", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.PropList("Material") ], CombatLogic.prototype, "tileMaterials", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector2") ], CombatLogic.prototype, "boardDimensions", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], CombatLogic.prototype, "maxColors", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(CombatLogic); /***/ }), /***/ "./Assets/Components/FloatObject.re.js": /*!*********************************************!*\ !*** ./Assets/Components/FloatObject.re.js ***! \*********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ FloatObject) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class FloatObject extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.elapsed = 0; this.amplitude = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0); this.offset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0); this.period = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 4, 0); } awake() { } start() { this.elapsed = 0; } update() { this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime; this.object3d.position.x = this.amplitude.x * Math.cos(this.period.x * this.elapsed) + this.offset.x; this.object3d.position.y = this.amplitude.y * Math.sin(this.period.y * this.elapsed) + this.offset.y; this.object3d.position.z = this.amplitude.z * Math.sin(this.period.z * this.elapsed) + this.offset.z; } } __name(FloatObject, "FloatObject"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], FloatObject.prototype, "amplitude", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], FloatObject.prototype, "offset", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], FloatObject.prototype, "period", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(FloatObject); /***/ }), /***/ "./Assets/Components/HouseRaycastReceiver.re.js": /*!******************************************************!*\ !*** ./Assets/Components/HouseRaycastReceiver.re.js ***! \******************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ HouseRaycastReceiver) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js"); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class HouseRaycastReceiver extends _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__["default"] { constructor() { super(...arguments); this.isHovered = false; this.elapsed = 0; this.clearHoverId = 0; } awake() { } start() { this.elapsed = 0; } update() { if (this.isHovered) { this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime; this.object3d.position.y = 0.5 * Math.sin(4 * this.elapsed) + 1; if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonUp(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.endTouches.length > 0) { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default"; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene("World Map"); } } else { if (this.object3d.position.y != 0) { this.object3d.position.y = 0; } } } onMouseOver(intersect) { if (!this.isHovered) { this.isHovered = true; } rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "pointer"; return false; } onMouseOut() { if (!this.isHovered) { return; } this.isHovered = false; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default"; } } __name(HouseRaycastReceiver, "HouseRaycastReceiver"); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(HouseRaycastReceiver); /***/ }), /***/ "./Assets/Components/Library/AsyncLoader.js": /*!**************************************************!*\ !*** ./Assets/Components/Library/AsyncLoader.js ***! \**************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ AsyncLoader) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class AsyncLoader { loadStaticText(filepath) { return new Promise((success, failure) => { fetch(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getStaticPath(filepath)).then((result) => { result.text().then((text) => { success(text); }, (error) => { failure(error); }); }, (error) => { failure(error); }); }); } } __name(AsyncLoader, "AsyncLoader"); /***/ }), /***/ "./Assets/Components/Library/Easings.js": /*!**********************************************!*\ !*** ./Assets/Components/Library/Easings.js ***! \**********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); var Easing = {}; Easing.Linear = {}; Easing.Linear.EaseNone = (percentageComplete) => percentageComplete; Easing.Quadratic = {}; Easing.Quadratic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete; Easing.Quadratic.EaseOut = (percentageComplete) => -percentageComplete * (percentageComplete - 2); Easing.Quadratic.EaseInOut = (percentageComplete) => { if ((percentageComplete *= 2) < 1) return 0.5 * percentageComplete * percentageComplete; return -0.5 * (--percentageComplete * (percentageComplete - 2) - 1); }; Easing.Cubic = {}; Easing.Cubic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete * percentageComplete; Easing.Cubic.EaseOut = (percentageComplete) => --percentageComplete * percentageComplete * percentageComplete + 1; Easing.Cubic.EaseInOut = (percentageComplete) => { if ((percentageComplete *= 2) < 1) return 0.5 * percentageComplete * percentageComplete * percentageComplete; return 0.5 * ((percentageComplete -= 2) * percentageComplete * percentageComplete + 2); }; Easing.Quartic = {}; Easing.Quartic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete * percentageComplete * percentageComplete; Easing.Quartic.EaseOut = (percentageComplete) => -(--percentageComplete * percentageComplete * percentageComplete * percentageComplete - 1); Easing.Quartic.EaseInOut = (percentageComplete) => { if ((percentageComplete *= 2) < 1) return 0.5 * percentageComplete * percentageComplete * percentageComplete * percentageComplete; return -0.5 * ((percentageComplete -= 2) * percentageComplete * percentageComplete * percentageComplete - 2); }; Easing.Quintic = {}; Easing.Quintic.EaseIn = (percentageComplete) => percentageComplete * percentageComplete * percentageComplete * percentageComplete * percentageComplete; Easing.Quintic.EaseOut = (percentageComplete) => (percentageComplete = percentageComplete - 1) * percentageComplete * percentageComplete * percentageComplete * percentageComplete + 1; Easing.Quintic.EaseInOut = (percentageComplete) => { if ((percentageComplete *= 2) < 1) return 0.5 * percentageComplete * percentageComplete * percentageComplete * percentageComplete * percentageComplete; return 0.5 * ((percentageComplete -= 2) * percentageComplete * percentageComplete * percentageComplete * percentageComplete + 2); }; Easing.Sinusoidal = {}; Easing.Sinusoidal.EaseIn = (percentageComplete) => -Math.cos(percentageComplete * Math.PI / 2) + 1; Easing.Sinusoidal.EaseOut = (percentageComplete) => Math.sin(percentageComplete * Math.PI / 2); Easing.Sinusoidal.EaseInOut = (percentageComplete) => -0.5 * (Math.cos(Math.PI * percentageComplete) - 1); Easing.Exponential = {}; Easing.Exponential.EaseIn = (percentageComplete) => { return percentageComplete == 0 ? 0 : Math.pow(2, 10 * (percentageComplete - 1)); }; Easing.Exponential.EaseOut = (percentageComplete) => { return percentageComplete == 1 ? 1 : -Math.pow(2, -10 * percentageComplete) + 1; }; Easing.Exponential.EaseInOut = (percentageComplete) => { if (percentageComplete == 0) return 0; if (percentageComplete == 1) return 1; if ((percentageComplete *= 2) < 1) return 0.5 * Math.pow(2, 10 * (percentageComplete - 1)); return 0.5 * (-Math.pow(2, -10 * (percentageComplete - 1)) + 2); }; Easing.Circular = {}; Easing.Circular.EaseIn = (percentageComplete) => -(Math.sqrt(1 - percentageComplete * percentageComplete) - 1); Easing.Circular.EaseOut = (percentageComplete) => Math.sqrt(1 - --percentageComplete * percentageComplete); Easing.Circular.EaseInOut = (percentageComplete) => { if ((percentageComplete /= 0.5) < 1) return -0.5 * (Math.sqrt(1 - percentageComplete * percentageComplete) - 1); return 0.5 * (Math.sqrt(1 - (percentageComplete -= 2) * percentageComplete) + 1); }; Easing.Elastic = {}; Easing.Elastic.EaseIn = (percentageComplete) => { var s, a = 0.1, p = 0.4; if (percentageComplete == 0) return 0; if (percentageComplete == 1) return 1; if (!p) p = 0.3; if (!a || a < 1) { a = 1; s = p / 4; } else s = p / (2 * Math.PI) * Math.asin(1 / a); return -(a * Math.pow(2, 10 * (percentageComplete -= 1)) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p)); }; Easing.Elastic.EaseOut = (percentageComplete) => { var s, a = 0.1, p = 0.4; if (percentageComplete == 0) return 0; if (percentageComplete == 1) return 1; if (!p) p = 0.3; if (!a || a < 1) { a = 1; s = p / 4; } else s = p / (2 * Math.PI) * Math.asin(1 / a); return a * Math.pow(2, -10 * percentageComplete) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p) + 1; }; Easing.Elastic.EaseInOut = (percentageComplete) => { var s, a = 0.1, p = 0.4; if (percentageComplete == 0) return 0; if (percentageComplete == 1) return 1; if (!p) p = 0.3; if (!a || a < 1) { a = 1; s = p / 4; } else s = p / (2 * Math.PI) * Math.asin(1 / a); if ((percentageComplete *= 2) < 1) return -0.5 * (a * Math.pow(2, 10 * (percentageComplete -= 1)) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p)); return a * Math.pow(2, -10 * (percentageComplete -= 1)) * Math.sin((percentageComplete - s) * (2 * Math.PI) / p) * 0.5 + 1; }; Easing.Back = {}; Easing.Back.EaseIn = (percentageComplete) => { var s = 1.70158; return percentageComplete * percentageComplete * ((s + 1) * percentageComplete - s); }; Easing.Back.EaseOut = (percentageComplete) => { var s = 1.70158; return (percentageComplete = percentageComplete - 1) * percentageComplete * ((s + 1) * percentageComplete + s) + 1; }; Easing.Back.EaseInOut = (percentageComplete) => { var s = 1.70158 * 1.525; if ((percentageComplete *= 2) < 1) return 0.5 * (percentageComplete * percentageComplete * ((s + 1) * percentageComplete - s)); return 0.5 * ((percentageComplete -= 2) * percentageComplete * ((s + 1) * percentageComplete + s) + 2); }; Easing.Bounce = {}; Easing.Bounce.EaseIn = (percentageComplete) => 1 - Easing.Bounce.EaseOut(1 - percentageComplete); Easing.Bounce.EaseOut = (percentageComplete) => { if ((percentageComplete /= 1) < 1 / 2.75) { return 7.5625 * percentageComplete * percentageComplete; } else if (percentageComplete < 2 / 2.75) { return 7.5625 * (percentageComplete -= 1.5 / 2.75) * percentageComplete + 0.75; } else if (percentageComplete < 2.5 / 2.75) { return 7.5625 * (percentageComplete -= 2.25 / 2.75) * percentageComplete + 0.9375; } else { return 7.5625 * (percentageComplete -= 2.625 / 2.75) * percentageComplete + 0.984375; } }; Easing.Bounce.EaseInOut = (percentageComplete) => { if (percentageComplete < 0.5) return Easing.Bounce.EaseIn(percentageComplete * 2) * 0.5; return Easing.Bounce.EaseOut(percentageComplete * 2 - 1) * 0.5 + 0.5; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Easing); /***/ }), /***/ "./Assets/Components/Library/GameData.js": /*!***********************************************!*\ !*** ./Assets/Components/Library/GameData.js ***! \***********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); var GameData = {}; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GameData); /***/ }), /***/ "./Assets/Components/Library/SimpleTweens.js": /*!***************************************************!*\ !*** ./Assets/Components/Library/SimpleTweens.js ***! \***************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "TweenManager": () => (/* binding */ TweenManager), /* harmony export */ "SimpleTween": () => (/* binding */ SimpleTween) /* harmony export */ }); /* harmony import */ var _Easings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Easings */ "./Assets/Components/Library/Easings.js"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class TweenManager { constructor() { this.activeTweens = []; this.elapsed = 0; } awake() { } start() { this.elapsed = 0; } update() { this.elapsed += rogue_engine__WEBPACK_IMPORTED_MODULE_1__.Runtime.deltaTime; let tweensToRemove = []; this.activeTweens.forEach((tween) => { if (tween.update(this.elapsed)) { tweensToRemove.push(tween); } }); for (let i = tweensToRemove.length - 1; i >= 0; i--) { this.remove(tweensToRemove[i]); } } add(simpleTween) { this.activeTweens.push(simpleTween); simpleTween.start(this.elapsed); } remove(simpleTween) { delete this.activeTweens[this.activeTweens.indexOf(simpleTween)]; } } __name(TweenManager, "TweenManager"); class SimpleTween { constructor(initialObject, targetProperties, duration = 1e3, easingFunction = _Easings__WEBPACK_IMPORTED_MODULE_0__["default"].Linear.EaseNone, onComplete = () => { }) { this.initialObject = initialObject; this.targetProperties = targetProperties; this.duration = duration / 1e3; this.easingFunction = easingFunction; this.onComplete = onComplete; } start(elapsed) { this.copy = {}; for (let key in this.targetProperties) { this.copy[key] = this.initialObject[key]; } this.begin = elapsed; } update(elapsed) { if (elapsed >= this.begin + this.duration) { for (let key in this.targetProperties) { this.initialObject[key] = this.targetProperties[key]; } this.onComplete(); return true; } let delta = (elapsed - this.begin) / this.duration; for (let key in this.targetProperties) { this.initialObject[key] = (this.targetProperties[key] - this.copy[key]) * this.easingFunction(delta) + this.copy[key]; } return false; } } __name(SimpleTween, "SimpleTween"); /***/ }), /***/ "./Assets/Components/OrbitCamera.re.js": /*!*********************************************!*\ !*** ./Assets/Components/OrbitCamera.re.js ***! \*********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ OrbitCamera) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class OrbitCamera extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.rotateStart = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(); this.rotateEnd = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(); this.rotateDelta = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(); this.enableRotate = true; this.rotateSpeed = 1; this.minAzimuthAngle = -Infinity; this.maxAzimuthAngle = Infinity; this.minPolarAngle = 0; this.maxPolarAngle = Math.PI; this.enableDolly = true; this.dollySpeed = 1; this.minDistance = 1; this.maxDistance = 50; this.scale = 1; this.EPS = 1e-6; this.twoPI = 2 * Math.PI; this.spherical = new three__WEBPACK_IMPORTED_MODULE_1__.Spherical(); this.sphericalDelta = new three__WEBPACK_IMPORTED_MODULE_1__.Spherical(); this.offset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(); this.rotateMouseButton = 2; this.quat = new three__WEBPACK_IMPORTED_MODULE_1__.Quaternion().setFromUnitVectors(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0), new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0)); this.quatInverse = this.quat.clone().invert(); this.lastPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(); this.lastQuaternion = new three__WEBPACK_IMPORTED_MODULE_1__.Quaternion(); this.initialOffset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(); } awake() { } start() { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.addEventListener("contextmenu", (event) => { event.preventDefault(); }); this.quat = new three__WEBPACK_IMPORTED_MODULE_1__.Quaternion().setFromUnitVectors(this.object3d.up, new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 1, 0)); this.quatInverse = this.quat.clone().invert(); this.initialOffset.copy(this.object3d.position).sub(this.target.position); this.offset.copy(this.initialOffset); } update() { let normalizedScreenPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(0, 0); this.normalizeScreenInput(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse, normalizedScreenPosition); if (this.enableRotate && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonDown(this.rotateMouseButton)) { this.rotateStart.set(normalizedScreenPosition.x, normalizedScreenPosition.y); } if (this.enableRotate && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonPressed(this.rotateMouseButton)) { this.rotateEnd.set(normalizedScreenPosition.x, normalizedScreenPosition.y); this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart).multiplyScalar(this.rotateSpeed); this.rotateLeft(this.twoPI * this.rotateDelta.x); this.rotateUp(this.twoPI * -this.rotateDelta.y); this.rotateStart.copy(this.rotateEnd); } if (this.enableDolly && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.wheelY > 0) { this.dollyOut(); } if (this.enableDolly && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.wheelY < 0) { this.dollyIn(); } this.updateCamera(); } rotateLeft(angle) { this.sphericalDelta.theta -= angle; } rotateUp(angle) { this.sphericalDelta.phi -= angle; } updateCamera() { this.offset.applyQuaternion(this.quat); this.spherical.setFromVector3(this.offset); this.spherical.theta += this.sphericalDelta.theta; this.spherical.phi += this.sphericalDelta.phi; let min = this.minAzimuthAngle; let max = this.maxAzimuthAngle; if (isFinite(min) && isFinite(max)) { if (min < -Math.PI) { min += this.twoPI; } else if (min > Math.PI) { min -= this.twoPI; } if (max < -Math.PI) { max += this.twoPI; } else if (max > Math.PI) { max -= this.twoPI; } if (min <= max) { this.spherical.theta = Math.max(min, Math.min(max, this.spherical.theta)); } else { this.spherical.theta = this.spherical.theta > (min + max) / 2 ? Math.max(min, this.spherical.theta) : Math.min(max, this.spherical.theta); } } this.spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this.spherical.phi)); this.spherical.makeSafe(); this.spherical.radius *= this.scale; this.spherical.radius = Math.max(this.minDistance, Math.min(this.maxDistance, this.spherical.radius)); this.offset.setFromSpherical(this.spherical); this.offset.applyQuaternion(this.quatInverse); this.object3d.position.copy(this.target.position).add(this.offset); this.object3d.lookAt(this.target.position); this.sphericalDelta.set(0, 0, 0); this.scale = 1; if (this.lastPosition.distanceToSquared(this.object3d.position) > this.EPS || 8 * (1 - this.lastQuaternion.dot(this.object3d.quaternion)) > this.EPS) { this.lastPosition.copy(this.object3d.position); this.lastQuaternion.copy(this.object3d.quaternion); } } dollyOut() { this.scale /= Math.pow(0.95, this.dollySpeed); } dollyIn() { this.scale *= Math.pow(0.95, this.dollySpeed); } normalizeScreenInput(browserVector, gameVector) { const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect(); gameVector.x = (browserVector.x - bounds.left) / bounds.width * 2 - 1; gameVector.y = -((browserVector.y - bounds.top) / bounds.height) * 2 + 1; } } __name(OrbitCamera, "OrbitCamera"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D") ], OrbitCamera.prototype, "target", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Boolean") ], OrbitCamera.prototype, "enableRotate", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "rotateSpeed", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "minAzimuthAngle", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "maxAzimuthAngle", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "minPolarAngle", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "maxPolarAngle", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Boolean") ], OrbitCamera.prototype, "enableDolly", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "dollySpeed", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "minDistance", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "maxDistance", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], OrbitCamera.prototype, "offset", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], OrbitCamera.prototype, "rotateMouseButton", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(OrbitCamera); /***/ }), /***/ "./Assets/Components/ParticleSystem.re.js": /*!************************************************!*\ !*** ./Assets/Components/ParticleSystem.re.js ***! \************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ ParticleSystem) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class ParticleSystem extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.vertexShader = ` uniform float pointMultiplier; varying vec4 vColor; void main() { vec4 mvPosition = modelViewMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * mvPosition; gl_PointSize = pointMultiplier / gl_Position.w; vColor = color; }`; this.fragmentShader = ` uniform sampler2D diffuseTexture; varying vec4 vColor; void main() { gl_FragColor = texture2D(diffuseTexture, gl_PointCoord) * vColor; }`; this.color = new three__WEBPACK_IMPORTED_MODULE_1__.Color(255, 255, 255); this.alpha = 1; this.blending = 0; this.blendingOptions = ["Additive", "Normal", "Multiply", "None", "Subtractive"]; this.max = 500; this.spawnPerTick = 1; this.lifespan = 2; this.initialVelocity = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0, 0); this.thrustScalar = 0.01; this.positionRandomBounds = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1, 1, 1); this.velocityRandomBounds = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1, 1, 1); } start() { const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect(); const uniforms = { diffuseTexture: { value: this.texture }, pointMultiplier: { value: bounds.width - bounds.left } }; this.material = new three__WEBPACK_IMPORTED_MODULE_1__.ShaderMaterial({ uniforms, vertexShader: this.vertexShader, fragmentShader: this.fragmentShader, blending: this.convertBlending(this.blending), depthTest: true, depthWrite: false, transparent: true, vertexColors: true }); this.geometry = new three__WEBPACK_IMPORTED_MODULE_1__.BufferGeometry(); this.geometry.setAttribute("position", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute([], 3)); this.geometry.setAttribute("color", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute([], 4)); this.globalPointsObject.geometry = this.geometry; this.globalPointsObject.material = this.material; this.particles = []; this.updateGeometry(); } convertBlending(selectIndex) { switch (this.blendingOptions[selectIndex]) { case "Additive": return three__WEBPACK_IMPORTED_MODULE_1__.AdditiveBlending; case "Normal": return three__WEBPACK_IMPORTED_MODULE_1__.NormalBlending; case "Multiply": return three__WEBPACK_IMPORTED_MODULE_1__.MultiplyBlending; case "None": return three__WEBPACK_IMPORTED_MODULE_1__.NoBlending; case "Subtractive": return three__WEBPACK_IMPORTED_MODULE_1__.SubtractiveBlending; default: return three__WEBPACK_IMPORTED_MODULE_1__.AdditiveBlending; } } awake() { } update() { this.addParticles(); this.updateParticles(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.deltaTime); this.updateGeometry(); } addParticles() { if (this.particles.length >= this.max) { return; } for (let i = 0; i < this.spawnPerTick; i++) { const life = this.lifespan; const newPosition = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(); this.initialLocation.getWorldPosition(newPosition); newPosition.add(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1 * Math.random() - 0.5, 1 * Math.random() - 0.5, 1 * Math.random() - 0.5).multiply(this.positionRandomBounds)); const newVelocity = this.initialVelocity.clone(); newVelocity.add(new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(1 * Math.random() - 0.5, 1 * Math.random() - 0.5, 1 * Math.random() - 0.5).multiply(this.velocityRandomBounds)); this.particles.push({ position: newPosition, life, maxLife: life, velocity: newVelocity, color: this.color, alpha: this.alpha }); } } updateGeometry() { const positions = []; const colors = []; for (let p of this.particles) { positions.push(p.position.x, p.position.y, p.position.z); colors.push(p.color.r, p.color.g, p.color.b, p.alpha); } this.geometry.setAttribute("position", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute(positions, 3)); this.geometry.setAttribute("color", new three__WEBPACK_IMPORTED_MODULE_1__.Float32BufferAttribute(colors, 4)); this.geometry.attributes.position.needsUpdate = true; this.geometry.attributes.color.needsUpdate = true; } updateParticles(deltaTime) { for (let p of this.particles) { p.life -= deltaTime; } this.particles = this.particles.filter((p) => { return p.life > 0; }); for (let p of this.particles) { p.position.add(p.velocity.clone()); } let camera = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.getObjectByProperty("uuid", rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.activeCamera); this.particles.sort((a, b) => { const d1 = camera.position.distanceTo(a.position); const d2 = camera.position.distanceTo(b.position); if (d1 > d2) { return -1; } if (d1 < d2) { return 1; } return 0; }); } } __name(ParticleSystem, "ParticleSystem"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Texture") ], ParticleSystem.prototype, "texture", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Color") ], ParticleSystem.prototype, "color", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], ParticleSystem.prototype, "alpha", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Select") ], ParticleSystem.prototype, "blending", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D") ], ParticleSystem.prototype, "globalPointsObject", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], ParticleSystem.prototype, "max", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], ParticleSystem.prototype, "spawnPerTick", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], ParticleSystem.prototype, "lifespan", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Object3D") ], ParticleSystem.prototype, "initialLocation", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], ParticleSystem.prototype, "initialVelocity", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Number") ], ParticleSystem.prototype, "thrustScalar", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], ParticleSystem.prototype, "positionRandomBounds", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], ParticleSystem.prototype, "velocityRandomBounds", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(ParticleSystem); /***/ }), /***/ "./Assets/Components/Pathway.re.js": /*!*****************************************!*\ !*** ./Assets/Components/Pathway.re.js ***! \*****************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ Pathway) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var three_examples_jsm_lines_LineGeometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three/examples/jsm/lines/LineGeometry */ "./node_modules/three/examples/jsm/lines/LineGeometry.js"); /* harmony import */ var three_examples_jsm_lines_LineMaterial__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! three/examples/jsm/lines/LineMaterial */ "./node_modules/three/examples/jsm/lines/LineMaterial.js"); /* harmony import */ var three_examples_jsm_lines_Line2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three/examples/jsm/lines/Line2 */ "./node_modules/three/examples/jsm/lines/Line2.js"); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class Pathway extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.linePoints = []; this.colors = []; this.lineColorShift = new three__WEBPACK_IMPORTED_MODULE_1__.Color(0.1, 0.1, 0.1); } awake() { } start() { this.lineGeo = new three_examples_jsm_lines_LineGeometry__WEBPACK_IMPORTED_MODULE_2__.LineGeometry(); this.lineMat = new three_examples_jsm_lines_LineMaterial__WEBPACK_IMPORTED_MODULE_3__.LineMaterial({ color: 16777215, linewidth: 5, vertexColors: true, dashed: false, wireframe: false }); const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect(); this.lineMat.resolution.set(bounds.width, bounds.height); } updateGeometry() { if (this.linePoints.length < 2) { return; } const positions = []; const colors = []; for (let p of this.linePoints) { positions.push(p.x, p.y, p.z); } for (let c of this.colors) { colors.push(Math.min(1, c.r + this.lineColorShift.r), Math.min(1, c.g + this.lineColorShift.g), Math.min(1, c.b + this.lineColorShift.b)); } this.lineGeo = new three_examples_jsm_lines_LineGeometry__WEBPACK_IMPORTED_MODULE_2__.LineGeometry(); this.lineGeo.setPositions(positions); this.lineGeo.setColors(colors); if (this.line) { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.remove(this.line); } this.line = new three_examples_jsm_lines_Line2__WEBPACK_IMPORTED_MODULE_4__.Line2(this.lineGeo, this.lineMat); this.line.scale.set(1, 1, 1); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.add(this.line); this.line.computeLineDistances(); } addPoint(position, color) { let dupePosition = position.clone(); dupePosition.y -= 4; dupePosition.z += 0.1; this.linePoints.push(dupePosition); this.colors.push(color); this.updateGeometry(); } recomputePath(tileComponents) { this.clearPoints(); tileComponents.forEach((tileComponent, index) => { this.addPoint(tileComponent.object3d.position, tileComponent.object3d.originalMaterial.color); }); this.updateGeometry(); } clearPoints() { this.linePoints.length = 0; this.colors.length = 0; if (this.line) { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.remove(this.line); } } update() { } } __name(Pathway, "Pathway"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.color() ], Pathway.prototype, "lineColorShift", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(Pathway); /***/ }), /***/ "./Assets/Components/RaycastReceiver.re.js": /*!*************************************************!*\ !*** ./Assets/Components/RaycastReceiver.re.js ***! \*************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ RaycastReceiver) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); class RaycastReceiver extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { onMouseOver(intersect) { throw new Error("Abstract class: Please inherit from this class to use it's behavior"); } onMouseOut() { throw new Error("Abstract class: Please inherit from this class to use it's behavior"); } } __name(RaycastReceiver, "RaycastReceiver"); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(RaycastReceiver); /***/ }), /***/ "./Assets/Components/RaycastReporter.re.js": /*!*************************************************!*\ !*** ./Assets/Components/RaycastReporter.re.js ***! \*************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ RaycastReporter) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js"); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class RaycastReporter extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.receiverClass = ["RaycastReceiver"]; this.allHovered = []; } awake() { } start() { this.mouse = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(0, 0); this.raycaster = new three__WEBPACK_IMPORTED_MODULE_1__.Raycaster(); this.updated = false; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.enabled = true; } normalizeScreenInput(browserVector, gameVector) { const bounds = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.getBoundingClientRect(); gameVector.x = (browserVector.x - bounds.left) / bounds.width * 2 - 1; gameVector.y = -((browserVector.y - bounds.top) / bounds.height) * 2 + 1; } getMouseInput() { if (!rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.isMoving) { return; } this.normalizeScreenInput(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse, this.mouse); this.updated = true; } getTouchInput() { if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.touches.length == 0) { return; } this.normalizeScreenInput(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.touches[0], this.mouse); this.updated = true; } update() { this.updated = false; this.getMouseInput(); this.getTouchInput(); if (!this.updated) { return; } this.raycaster.setFromCamera(this.mouse, this.object3d); let intersects = this.raycaster.intersectObjects(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.children); let listeningComponents = []; intersects.forEach((intersect) => { let object3d = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.currentScene.getObjectByProperty("uuid", intersect.object.uuid); let component = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_2__["default"], object3d); while (component == null && object3d.parent != null) { object3d = object3d.parent; component = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_2__["default"], object3d); } if (component != null) { listeningComponents = listeningComponents.filter((dataThing) => { dataThing.component.object3d.uuid != component.object3d.uuid; }); listeningComponents.push({ component, intersect }); } }); for (let i = 0; i < this.allHovered.length; i++) { let dataThing = this.allHovered[i]; if (!listeningComponents.includes(dataThing)) { dataThing.component.onMouseOut(); } } this.allHovered = []; for (let i = 0; i < listeningComponents.length; i++) { let dataThing = listeningComponents[i]; this.allHovered.push(dataThing); if (dataThing.component.onMouseOver(dataThing.intersect) === false) { break; } } } } __name(RaycastReporter, "RaycastReporter"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.PropList("String") ], RaycastReporter.prototype, "receiverClass", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(RaycastReporter); /***/ }), /***/ "./Assets/Components/SceneLinkRaycastReceiver.re.js": /*!**********************************************************!*\ !*** ./Assets/Components/SceneLinkRaycastReceiver.re.js ***! \**********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ SceneLinkRaycastReceiver) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js"); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class SceneLinkRaycastReceiver extends _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__["default"] { awake() { } start() { } update() { if (this.isHovered && (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonUp(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.endTouches.length > 0)) { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default"; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.targetScene); } } onMouseOver(intersect) { this.isHovered = true; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "pointer"; } onMouseOut() { this.isHovered = false; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default"; } } __name(SceneLinkRaycastReceiver, "SceneLinkRaycastReceiver"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("String") ], SceneLinkRaycastReceiver.prototype, "targetScene", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(SceneLinkRaycastReceiver); /***/ }), /***/ "./Assets/Components/ScrollObject.re.js": /*!**********************************************!*\ !*** ./Assets/Components/ScrollObject.re.js ***! \**********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ ScrollObject) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class ScrollObject extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.offsetPerTick = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 0.01, 0); this.completedBound = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3(0, 10, 0); this.nextScene = "Title Screen"; } awake() { } start() { } update() { this.object3d.position.add(this.offsetPerTick); if (this.object3d.position.x >= this.completedBound.x && this.object3d.position.y >= this.completedBound.y && this.object3d.position.z >= this.completedBound.z) { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.nextScene); } } } __name(ScrollObject, "ScrollObject"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], ScrollObject.prototype, "offsetPerTick", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector3") ], ScrollObject.prototype, "completedBound", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(ScrollObject); /***/ }), /***/ "./Assets/Components/ScrollTexture.re.js": /*!***********************************************!*\ !*** ./Assets/Components/ScrollTexture.re.js ***! \***********************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ ScrollTexture) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_1__); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class ScrollTexture extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.offsetPerTick = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(-1e-3, 1e-3); } update() { this.materialToOffset.map.offset.add(this.offsetPerTick); } } __name(ScrollTexture, "ScrollTexture"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector2") ], ScrollTexture.prototype, "offsetPerTick", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Material") ], ScrollTexture.prototype, "materialToOffset", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(ScrollTexture); /***/ }), /***/ "./Assets/Components/TileRaycastReceiver.re.js": /*!*****************************************************!*\ !*** ./Assets/Components/TileRaycastReceiver.re.js ***! \*****************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ TileRaycastReceiver) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RaycastReceiver.re */ "./Assets/Components/RaycastReceiver.re.js"); /* harmony import */ var _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Library/SimpleTweens */ "./Assets/Components/Library/SimpleTweens.js"); /* harmony import */ var _Library_Easings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Library/Easings */ "./Assets/Components/Library/Easings.js"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(three__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _CombatLogic_re__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./CombatLogic.re */ "./Assets/Components/CombatLogic.re.js"); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class TileRaycastReceiver extends _RaycastReceiver_re__WEBPACK_IMPORTED_MODULE_1__["default"] { constructor() { super(...arguments); this.tileSize = new three__WEBPACK_IMPORTED_MODULE_4__.Vector2(1.1, 1.1); } onMouseOver(intersect) { if (this.object3d.isAnimating) { return; } this.currentObj = intersect.object; this.currentObj.material = this.currentObj.highlightMaterial; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "pointer"; if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonPressed(0) || rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.touch.touches.length == 1) { let game = rogue_engine__WEBPACK_IMPORTED_MODULE_0__.getComponent(_CombatLogic_re__WEBPACK_IMPORTED_MODULE_5__["default"]); let [isAdded, selectedTiles] = game.addTile(this); if (isAdded) { if (this.hoverSound) { this.hoverSound.play(); } } else { if (selectedTiles[selectedTiles.length - 1] != this) { this.currentObj.material = this.currentObj.originalMaterial; } } } } onMouseOut() { if (this.object3d.isAnimating || !this.currentObj) { return; } if (rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.getButtonPressed(0)) { } this.currentObj.material = this.currentObj.originalMaterial; rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.rogueDOMContainer.style.cursor = "default"; } getOriginalMaterial() { return this.object3d.originalMaterial; } getPosition() { return this.object3d.position; } awake() { } start() { if (this.dropInSound) { this.dropInSound.setVolume(0.7); this.dropInSound.setLoop(false); } if (this.hoverSound) { this.hoverSound.setVolume(0.7); this.hoverSound.setLoop(false); } if (this.clearSound) { this.clearSound.setVolume(1); this.clearSound.setLoop(false); } } update() { } initialize(gridPosition, boardDimensions, originalMaterial, hoverMaterial, tweenManager, delay, startingZ, easingFunction) { let offset = new three__WEBPACK_IMPORTED_MODULE_4__.Vector2((boardDimensions.x * this.tileSize.x - 1) / 2, (boardDimensions.y * this.tileSize.y - 1) / 2); let actualPosition = new three__WEBPACK_IMPORTED_MODULE_4__.Vector3(this.tileSize.x * gridPosition.x - offset.x, this.tileSize.y * gridPosition.y - offset.y, startingZ); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Debug.log(JSON.stringify(actualPosition)); this.object3d.position.copy(actualPosition); this.object3d.originalMaterial = originalMaterial; this.object3d.highlightMaterial = hoverMaterial; this.object3d.material = originalMaterial; this.object3d.gridPosition = gridPosition; this.object3d.isAnimating = true; setTimeout(() => { if (this.dropInSound) { this.dropInSound.play(); } }, delay / 3 * Math.random()); tweenManager.add(new _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__.SimpleTween(this.object3d.position, { z: 0 }, delay, easingFunction, () => { this.object3d.isAnimating = false; })); } remove(tweenManager) { this.object3d.isAnimating = true; setTimeout(() => { if (this.clearSound) { this.clearSound.play(); } }, 150 * Math.random()); tweenManager.add(new _Library_SimpleTweens__WEBPACK_IMPORTED_MODULE_2__.SimpleTween(this.object3d.position, { z: -14 }, Math.floor(1500 * Math.random()) + 300, _Library_Easings__WEBPACK_IMPORTED_MODULE_3__["default"].Quadratic.EaseIn, () => { this.object3d.parent.remove(this.object3d); })); } } __name(TileRaycastReceiver, "TileRaycastReceiver"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Vector2") ], TileRaycastReceiver.prototype, "tileSize", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Audio") ], TileRaycastReceiver.prototype, "dropInSound", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Audio") ], TileRaycastReceiver.prototype, "hoverSound", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Prop("Audio") ], TileRaycastReceiver.prototype, "clearSound", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(TileRaycastReceiver); /***/ }), /***/ "./Assets/Components/TitleScreenControl.re.js": /*!****************************************************!*\ !*** ./Assets/Components/TitleScreenControl.re.js ***! \****************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ TitleScreenControl) /* harmony export */ }); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rogue-engine */ "rogue-engine"); /* harmony import */ var rogue_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(rogue_engine__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Library/AsyncLoader */ "./Assets/Components/Library/AsyncLoader.js"); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; class TitleScreenControl extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Component { constructor() { super(...arguments); this.introScene = "Combat Screen"; this.creditsScene = "Credits"; this.loader = new _Library_AsyncLoader__WEBPACK_IMPORTED_MODULE_1__["default"](); } awake() { } start() { this.loader.loadStaticText("title-screen.html").then((html) => { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.uiContainer.innerHTML = html; document.getElementById("play-button").addEventListener("mouseup", () => { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.introScene); }); document.getElementById("play-button").addEventListener("touchend", () => { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.introScene); }); document.getElementById("credits-button").addEventListener("mouseup", () => { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.creditsScene); }); document.getElementById("credits-button").addEventListener("touchend", () => { rogue_engine__WEBPACK_IMPORTED_MODULE_0__.App.loadScene(this.creditsScene); }); }); } update() { } } __name(TitleScreenControl, "TitleScreenControl"); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.text() ], TitleScreenControl.prototype, "introScene", 2); __decorateClass([ rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.text() ], TitleScreenControl.prototype, "creditsScene", 2); rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(TitleScreenControl); /***/ }), /***/ "rogue-engine": /*!******************************************************************************************************************!*\ !*** external {"commonjs":"rogue-engine","commonjs2":"rogue-engine","amd":"rogue-engine","root":"rogue-engine"} ***! \******************************************************************************************************************/ /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE_rogue_engine__; /***/ }), /***/ "three": /*!**************************************************************************************!*\ !*** external {"commonjs":"three","commonjs2":"three","amd":"three","root":"three"} ***! \**************************************************************************************/ /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_MODULE_three__; /***/ }), /***/ "./node_modules/three/examples/jsm/lines/Line2.js": /*!********************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/Line2.js ***! \********************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Line2": () => (/* binding */ Line2) /* harmony export */ }); /* harmony import */ var _lines_LineSegments2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lines/LineSegments2.js */ "./node_modules/three/examples/jsm/lines/LineSegments2.js"); /* harmony import */ var _lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineGeometry.js */ "./node_modules/three/examples/jsm/lines/LineGeometry.js"); /* harmony import */ var _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lines/LineMaterial.js */ "./node_modules/three/examples/jsm/lines/LineMaterial.js"); class Line2 extends _lines_LineSegments2_js__WEBPACK_IMPORTED_MODULE_0__.LineSegments2 { constructor( geometry = new _lines_LineGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineGeometry(), material = new _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial( { color: Math.random() * 0xffffff } ) ) { super( geometry, material ); this.type = 'Line2'; } } Line2.prototype.isLine2 = true; /***/ }), /***/ "./node_modules/three/examples/jsm/lines/LineGeometry.js": /*!***************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/LineGeometry.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "LineGeometry": () => (/* binding */ LineGeometry) /* harmony export */ }); /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js"); class LineGeometry extends _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_0__.LineSegmentsGeometry { constructor() { super(); this.type = 'LineGeometry'; } setPositions( array ) { // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format var length = array.length - 3; var points = new Float32Array( 2 * length ); for ( var i = 0; i < length; i += 3 ) { points[ 2 * i ] = array[ i ]; points[ 2 * i + 1 ] = array[ i + 1 ]; points[ 2 * i + 2 ] = array[ i + 2 ]; points[ 2 * i + 3 ] = array[ i + 3 ]; points[ 2 * i + 4 ] = array[ i + 4 ]; points[ 2 * i + 5 ] = array[ i + 5 ]; } super.setPositions( points ); return this; } setColors( array ) { // converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format var length = array.length - 3; var colors = new Float32Array( 2 * length ); for ( var i = 0; i < length; i += 3 ) { colors[ 2 * i ] = array[ i ]; colors[ 2 * i + 1 ] = array[ i + 1 ]; colors[ 2 * i + 2 ] = array[ i + 2 ]; colors[ 2 * i + 3 ] = array[ i + 3 ]; colors[ 2 * i + 4 ] = array[ i + 4 ]; colors[ 2 * i + 5 ] = array[ i + 5 ]; } super.setColors( colors ); return this; } fromLine( line ) { var geometry = line.geometry; if ( geometry.isGeometry ) { console.error( 'THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.' ); return; } else if ( geometry.isBufferGeometry ) { this.setPositions( geometry.attributes.position.array ); // assumes non-indexed } // set colors, maybe return this; } } LineGeometry.prototype.isLineGeometry = true; /***/ }), /***/ "./node_modules/three/examples/jsm/lines/LineMaterial.js": /*!***************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/LineMaterial.js ***! \***************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "LineMaterial": () => (/* binding */ LineMaterial) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /** * parameters = { * color: , * linewidth: , * dashed: , * dashScale: , * dashSize: , * gapSize: , * resolution: , // to be set by renderer * } */ three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line = { worldUnits: { value: 1 }, linewidth: { value: 1 }, resolution: { value: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2( 1, 1 ) }, dashScale: { value: 1 }, dashSize: { value: 1 }, gapSize: { value: 1 } // todo FIX - maybe change to totalSize }; three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line = { uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.merge( [ three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.common, three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.fog, three__WEBPACK_IMPORTED_MODULE_0__.UniformsLib.line ] ), vertexShader: /* glsl */` #include #include #include #include #include uniform float linewidth; uniform vec2 resolution; attribute vec3 instanceStart; attribute vec3 instanceEnd; attribute vec3 instanceColorStart; attribute vec3 instanceColorEnd; #ifdef WORLD_UNITS varying vec4 worldPos; varying vec3 worldStart; varying vec3 worldEnd; #ifdef USE_DASH varying vec2 vUv; #endif #else varying vec2 vUv; #endif #ifdef USE_DASH uniform float dashScale; attribute float instanceDistanceStart; attribute float instanceDistanceEnd; varying float vLineDistance; #endif void trimSegment( const in vec4 start, inout vec4 end ) { // trim end segment so it terminates between the camera plane and the near plane // conservative estimate of the near plane float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column float nearEstimate = - 0.5 * b / a; float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); end.xyz = mix( start.xyz, end.xyz, alpha ); } void main() { #ifdef USE_COLOR vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; #endif #ifdef USE_DASH vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; vUv = uv; #endif float aspect = resolution.x / resolution.y; // camera space vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); #ifdef WORLD_UNITS worldStart = start.xyz; worldEnd = end.xyz; #else vUv = uv; #endif // special case for perspective projection, and segments that terminate either in, or behind, the camera plane // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space // but we need to perform ndc-space calculations in the shader, so we must address this issue directly // perhaps there is a more elegant solution -- WestLangley bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column if ( perspective ) { if ( start.z < 0.0 && end.z >= 0.0 ) { trimSegment( start, end ); } else if ( end.z < 0.0 && start.z >= 0.0 ) { trimSegment( end, start ); } } // clip space vec4 clipStart = projectionMatrix * start; vec4 clipEnd = projectionMatrix * end; // ndc space vec3 ndcStart = clipStart.xyz / clipStart.w; vec3 ndcEnd = clipEnd.xyz / clipEnd.w; // direction vec2 dir = ndcEnd.xy - ndcStart.xy; // account for clip-space aspect ratio dir.x *= aspect; dir = normalize( dir ); #ifdef WORLD_UNITS // get the offset direction as perpendicular to the view vector vec3 worldDir = normalize( end.xyz - start.xyz ); vec3 offset; if ( position.y < 0.5 ) { offset = normalize( cross( start.xyz, worldDir ) ); } else { offset = normalize( cross( end.xyz, worldDir ) ); } // sign flip if ( position.x < 0.0 ) offset *= - 1.0; float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) ); // don't extend the line if we're rendering dashes because we // won't be rendering the endcaps #ifndef USE_DASH // extend the line bounds to encompass endcaps start.xyz += - worldDir * linewidth * 0.5; end.xyz += worldDir * linewidth * 0.5; // shift the position of the quad so it hugs the forward edge of the line offset.xy -= dir * forwardOffset; offset.z += 0.5; #endif // endcaps if ( position.y > 1.0 || position.y < 0.0 ) { offset.xy += dir * 2.0 * forwardOffset; } // adjust for linewidth offset *= linewidth * 0.5; // set the world position worldPos = ( position.y < 0.5 ) ? start : end; worldPos.xyz += offset; // project the worldpos vec4 clip = projectionMatrix * worldPos; // shift the depth of the projected points so the line // segements overlap neatly vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; clip.z = clipPose.z * clip.w; #else vec2 offset = vec2( dir.y, - dir.x ); // undo aspect ratio adjustment dir.x /= aspect; offset.x /= aspect; // sign flip if ( position.x < 0.0 ) offset *= - 1.0; // endcaps if ( position.y < 0.0 ) { offset += - dir; } else if ( position.y > 1.0 ) { offset += dir; } // adjust for linewidth offset *= linewidth; // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... offset /= resolution.y; // select end vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; // back to clip space offset *= clip.w; clip.xy += offset; #endif gl_Position = clip; vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation #include #include #include } `, fragmentShader: /* glsl */` uniform vec3 diffuse; uniform float opacity; uniform float linewidth; #ifdef USE_DASH uniform float dashSize; uniform float gapSize; #endif varying float vLineDistance; #ifdef WORLD_UNITS varying vec4 worldPos; varying vec3 worldStart; varying vec3 worldEnd; #ifdef USE_DASH varying vec2 vUv; #endif #else varying vec2 vUv; #endif #include #include #include #include #include vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { float mua; float mub; vec3 p13 = p1 - p3; vec3 p43 = p4 - p3; vec3 p21 = p2 - p1; float d1343 = dot( p13, p43 ); float d4321 = dot( p43, p21 ); float d1321 = dot( p13, p21 ); float d4343 = dot( p43, p43 ); float d2121 = dot( p21, p21 ); float denom = d2121 * d4343 - d4321 * d4321; float numer = d1343 * d4321 - d1321 * d4343; mua = numer / denom; mua = clamp( mua, 0.0, 1.0 ); mub = ( d1343 + d4321 * ( mua ) ) / d4343; mub = clamp( mub, 0.0, 1.0 ); return vec2( mua, mub ); } void main() { #include #ifdef USE_DASH if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX #endif float alpha = opacity; #ifdef WORLD_UNITS // Find the closest points on the view ray and the line segment vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; vec3 lineDir = worldEnd - worldStart; vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); vec3 p1 = worldStart + lineDir * params.x; vec3 p2 = rayEnd * params.y; vec3 delta = p1 - p2; float len = length( delta ); float norm = len / linewidth; #ifndef USE_DASH #ifdef USE_ALPHA_TO_COVERAGE float dnorm = fwidth( norm ); alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); #else if ( norm > 0.5 ) { discard; } #endif #endif #else #ifdef USE_ALPHA_TO_COVERAGE // artifacts appear on some hardware if a derivative is taken within a conditional float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; float dlen = fwidth( len2 ); if ( abs( vUv.y ) > 1.0 ) { alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); } #else if ( abs( vUv.y ) > 1.0 ) { float a = vUv.x; float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; float len2 = a * a + b * b; if ( len2 > 1.0 ) discard; } #endif #endif vec4 diffuseColor = vec4( diffuse, alpha ); #include #include gl_FragColor = vec4( diffuseColor.rgb, alpha ); #include #include #include #include } ` }; class LineMaterial extends three__WEBPACK_IMPORTED_MODULE_0__.ShaderMaterial { constructor( parameters ) { super( { type: 'LineMaterial', uniforms: three__WEBPACK_IMPORTED_MODULE_0__.UniformsUtils.clone( three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.uniforms ), vertexShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.vertexShader, fragmentShader: three__WEBPACK_IMPORTED_MODULE_0__.ShaderLib.line.fragmentShader, clipping: true // required for clipping support } ); Object.defineProperties( this, { color: { enumerable: true, get: function () { return this.uniforms.diffuse.value; }, set: function ( value ) { this.uniforms.diffuse.value = value; } }, worldUnits: { enumerable: true, get: function () { return 'WORLD_UNITS' in this.defines; }, set: function ( value ) { if ( value === true ) { this.defines.WORLD_UNITS = ''; } else { delete this.defines.WORLD_UNITS; } } }, linewidth: { enumerable: true, get: function () { return this.uniforms.linewidth.value; }, set: function ( value ) { this.uniforms.linewidth.value = value; } }, dashed: { enumerable: true, get: function () { return Boolean( 'USE_DASH' in this.defines ); }, set( value ) { if ( Boolean( value ) !== Boolean( 'USE_DASH' in this.defines ) ) { this.needsUpdate = true; } if ( value === true ) { this.defines.USE_DASH = ''; } else { delete this.defines.USE_DASH; } } }, dashScale: { enumerable: true, get: function () { return this.uniforms.dashScale.value; }, set: function ( value ) { this.uniforms.dashScale.value = value; } }, dashSize: { enumerable: true, get: function () { return this.uniforms.dashSize.value; }, set: function ( value ) { this.uniforms.dashSize.value = value; } }, dashOffset: { enumerable: true, get: function () { return this.uniforms.dashOffset.value; }, set: function ( value ) { this.uniforms.dashOffset.value = value; } }, gapSize: { enumerable: true, get: function () { return this.uniforms.gapSize.value; }, set: function ( value ) { this.uniforms.gapSize.value = value; } }, opacity: { enumerable: true, get: function () { return this.uniforms.opacity.value; }, set: function ( value ) { this.uniforms.opacity.value = value; } }, resolution: { enumerable: true, get: function () { return this.uniforms.resolution.value; }, set: function ( value ) { this.uniforms.resolution.value.copy( value ); } }, alphaToCoverage: { enumerable: true, get: function () { return Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ); }, set: function ( value ) { if ( Boolean( value ) !== Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ) ) { this.needsUpdate = true; } if ( value === true ) { this.defines.USE_ALPHA_TO_COVERAGE = ''; this.extensions.derivatives = true; } else { delete this.defines.USE_ALPHA_TO_COVERAGE; this.extensions.derivatives = false; } } } } ); this.setValues( parameters ); } } LineMaterial.prototype.isLineMaterial = true; /***/ }), /***/ "./node_modules/three/examples/jsm/lines/LineSegments2.js": /*!****************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/LineSegments2.js ***! \****************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "LineSegments2": () => (/* binding */ LineSegments2) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); /* harmony import */ var _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lines/LineSegmentsGeometry.js */ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js"); /* harmony import */ var _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lines/LineMaterial.js */ "./node_modules/three/examples/jsm/lines/LineMaterial.js"); const _start = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); const _end = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); const _start4 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4(); const _end4 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4(); const _ssOrigin = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4(); const _ssOrigin3 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); const _mvMatrix = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4(); const _line = new three__WEBPACK_IMPORTED_MODULE_0__.Line3(); const _closestPoint = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); const _box = new three__WEBPACK_IMPORTED_MODULE_0__.Box3(); const _sphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere(); const _clipToWorldVector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector4(); class LineSegments2 extends three__WEBPACK_IMPORTED_MODULE_0__.Mesh { constructor( geometry = new _lines_LineSegmentsGeometry_js__WEBPACK_IMPORTED_MODULE_1__.LineSegmentsGeometry(), material = new _lines_LineMaterial_js__WEBPACK_IMPORTED_MODULE_2__.LineMaterial( { color: Math.random() * 0xffffff } ) ) { super( geometry, material ); this.type = 'LineSegments2'; } // for backwards-compatability, but could be a method of LineSegmentsGeometry... computeLineDistances() { const geometry = this.geometry; const instanceStart = geometry.attributes.instanceStart; const instanceEnd = geometry.attributes.instanceEnd; const lineDistances = new Float32Array( 2 * instanceStart.count ); for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) { _start.fromBufferAttribute( instanceStart, i ); _end.fromBufferAttribute( instanceEnd, i ); lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end ); } const instanceDistanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 geometry.setAttribute( 'instanceDistanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 geometry.setAttribute( 'instanceDistanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 return this; } raycast( raycaster, intersects ) { if ( raycaster.camera === null ) { console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.' ); } const threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0; const ray = raycaster.ray; const camera = raycaster.camera; const projectionMatrix = camera.projectionMatrix; const matrixWorld = this.matrixWorld; const geometry = this.geometry; const material = this.material; const resolution = material.resolution; const lineWidth = material.linewidth + threshold; const instanceStart = geometry.attributes.instanceStart; const instanceEnd = geometry.attributes.instanceEnd; // camera forward is negative const near = - camera.near; // clip space is [ - 1, 1 ] so multiply by two to get the full // width in clip space const ssMaxWidth = 2.0 * Math.max( lineWidth / resolution.width, lineWidth / resolution.height ); // // check if we intersect the sphere bounds if ( geometry.boundingSphere === null ) { geometry.computeBoundingSphere(); } _sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld ); const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( ray.origin ) ); // get the w component to scale the world space line width _clipToWorldVector.set( 0, 0, - distanceToSphere, 1.0 ).applyMatrix4( camera.projectionMatrix ); _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w ); _clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse ); // increase the sphere bounds by the worst case line screen space width const sphereMargin = Math.abs( ssMaxWidth / _clipToWorldVector.w ) * 0.5; _sphere.radius += sphereMargin; if ( raycaster.ray.intersectsSphere( _sphere ) === false ) { return; } // // check if we intersect the box bounds if ( geometry.boundingBox === null ) { geometry.computeBoundingBox(); } _box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld ); const distanceToBox = Math.max( camera.near, _box.distanceToPoint( ray.origin ) ); // get the w component to scale the world space line width _clipToWorldVector.set( 0, 0, - distanceToBox, 1.0 ).applyMatrix4( camera.projectionMatrix ); _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w ); _clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse ); // increase the sphere bounds by the worst case line screen space width const boxMargin = Math.abs( ssMaxWidth / _clipToWorldVector.w ) * 0.5; _box.max.x += boxMargin; _box.max.y += boxMargin; _box.max.z += boxMargin; _box.min.x -= boxMargin; _box.min.y -= boxMargin; _box.min.z -= boxMargin; if ( raycaster.ray.intersectsBox( _box ) === false ) { return; } // // pick a point 1 unit out along the ray to avoid the ray origin // sitting at the camera origin which will cause "w" to be 0 when // applying the projection matrix. ray.at( 1, _ssOrigin ); // ndc space [ - 1.0, 1.0 ] _ssOrigin.w = 1; _ssOrigin.applyMatrix4( camera.matrixWorldInverse ); _ssOrigin.applyMatrix4( projectionMatrix ); _ssOrigin.multiplyScalar( 1 / _ssOrigin.w ); // screen space _ssOrigin.x *= resolution.x / 2; _ssOrigin.y *= resolution.y / 2; _ssOrigin.z = 0; _ssOrigin3.copy( _ssOrigin ); _mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld ); for ( let i = 0, l = instanceStart.count; i < l; i ++ ) { _start4.fromBufferAttribute( instanceStart, i ); _end4.fromBufferAttribute( instanceEnd, i ); _start4.w = 1; _end4.w = 1; // camera space _start4.applyMatrix4( _mvMatrix ); _end4.applyMatrix4( _mvMatrix ); // skip the segment if it's entirely behind the camera var isBehindCameraNear = _start4.z > near && _end4.z > near; if ( isBehindCameraNear ) { continue; } // trim the segment if it extends behind camera near if ( _start4.z > near ) { const deltaDist = _start4.z - _end4.z; const t = ( _start4.z - near ) / deltaDist; _start4.lerp( _end4, t ); } else if ( _end4.z > near ) { const deltaDist = _end4.z - _start4.z; const t = ( _end4.z - near ) / deltaDist; _end4.lerp( _start4, t ); } // clip space _start4.applyMatrix4( projectionMatrix ); _end4.applyMatrix4( projectionMatrix ); // ndc space [ - 1.0, 1.0 ] _start4.multiplyScalar( 1 / _start4.w ); _end4.multiplyScalar( 1 / _end4.w ); // screen space _start4.x *= resolution.x / 2; _start4.y *= resolution.y / 2; _end4.x *= resolution.x / 2; _end4.y *= resolution.y / 2; // create 2d segment _line.start.copy( _start4 ); _line.start.z = 0; _line.end.copy( _end4 ); _line.end.z = 0; // get closest point on ray to segment const param = _line.closestPointToPointParameter( _ssOrigin3, true ); _line.at( param, _closestPoint ); // check if the intersection point is within clip space const zPos = three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.lerp( _start4.z, _end4.z, param ); const isInClipSpace = zPos >= - 1 && zPos <= 1; const isInside = _ssOrigin3.distanceTo( _closestPoint ) < lineWidth * 0.5; if ( isInClipSpace && isInside ) { _line.start.fromBufferAttribute( instanceStart, i ); _line.end.fromBufferAttribute( instanceEnd, i ); _line.start.applyMatrix4( matrixWorld ); _line.end.applyMatrix4( matrixWorld ); const pointOnLine = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); const point = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine ); intersects.push( { point: point, pointOnLine: pointOnLine, distance: ray.origin.distanceTo( point ), object: this, face: null, faceIndex: i, uv: null, uv2: null, } ); } } } } LineSegments2.prototype.LineSegments2 = true; /***/ }), /***/ "./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js": /*!***********************************************************************!*\ !*** ./node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js ***! \***********************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "LineSegmentsGeometry": () => (/* binding */ LineSegmentsGeometry) /* harmony export */ }); /* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ "three"); const _box = new three__WEBPACK_IMPORTED_MODULE_0__.Box3(); const _vector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(); class LineSegmentsGeometry extends three__WEBPACK_IMPORTED_MODULE_0__.InstancedBufferGeometry { constructor() { super(); this.type = 'LineSegmentsGeometry'; const positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ]; const uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ]; const index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ]; this.setIndex( index ); this.setAttribute( 'position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( positions, 3 ) ); this.setAttribute( 'uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute( uvs, 2 ) ); } applyMatrix4( matrix ) { const start = this.attributes.instanceStart; const end = this.attributes.instanceEnd; if ( start !== undefined ) { start.applyMatrix4( matrix ); end.applyMatrix4( matrix ); start.needsUpdate = true; } if ( this.boundingBox !== null ) { this.computeBoundingBox(); } if ( this.boundingSphere !== null ) { this.computeBoundingSphere(); } return this; } setPositions( array ) { let lineSegments; if ( array instanceof Float32Array ) { lineSegments = array; } else if ( Array.isArray( array ) ) { lineSegments = new Float32Array( array ); } const instanceBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz this.setAttribute( 'instanceStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz this.setAttribute( 'instanceEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz // this.computeBoundingBox(); this.computeBoundingSphere(); return this; } setColors( array ) { let colors; if ( array instanceof Float32Array ) { colors = array; } else if ( Array.isArray( array ) ) { colors = new Float32Array( array ); } const instanceColorBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb this.setAttribute( 'instanceColorStart', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb this.setAttribute( 'instanceColorEnd', new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb return this; } fromWireframeGeometry( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; } fromEdgesGeometry( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; } fromMesh( mesh ) { this.fromWireframeGeometry( new three__WEBPACK_IMPORTED_MODULE_0__.WireframeGeometry( mesh.geometry ) ); // set colors, maybe return this; } fromLineSegments( lineSegments ) { const geometry = lineSegments.geometry; if ( geometry.isGeometry ) { console.error( 'THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.' ); return; } else if ( geometry.isBufferGeometry ) { this.setPositions( geometry.attributes.position.array ); // assumes non-indexed } // set colors, maybe return this; } computeBoundingBox() { if ( this.boundingBox === null ) { this.boundingBox = new three__WEBPACK_IMPORTED_MODULE_0__.Box3(); } const start = this.attributes.instanceStart; const end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { this.boundingBox.setFromBufferAttribute( start ); _box.setFromBufferAttribute( end ); this.boundingBox.union( _box ); } } computeBoundingSphere() { if ( this.boundingSphere === null ) { this.boundingSphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere(); } if ( this.boundingBox === null ) { this.computeBoundingBox(); } const start = this.attributes.instanceStart; const end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { const center = this.boundingSphere.center; this.boundingBox.getCenter( center ); let maxRadiusSq = 0; for ( let i = 0, il = start.count; i < il; i ++ ) { _vector.fromBufferAttribute( start, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) ); _vector.fromBufferAttribute( end, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) ); } this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); if ( isNaN( this.boundingSphere.radius ) ) { console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this ); } } } toJSON() { // todo } applyMatrix( matrix ) { console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' ); return this.applyMatrix4( matrix ); } } LineSegmentsGeometry.prototype.isLineSegmentsGeometry = true; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ /************************************************************************/ /******/ /* webpack/runtime/chunk loaded */ /******/ (() => { /******/ var deferred = []; /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { /******/ if(chunkIds) { /******/ priority = priority || 0; /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; /******/ deferred[i] = [chunkIds, fn, priority]; /******/ return; /******/ } /******/ var notFulfilled = Infinity; /******/ for (var i = 0; i < deferred.length; i++) { /******/ var [chunkIds, fn, priority] = deferred[i]; /******/ var fulfilled = true; /******/ for (var j = 0; j < chunkIds.length; j++) { /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { /******/ chunkIds.splice(j--, 1); /******/ } else { /******/ fulfilled = false; /******/ if(priority < notFulfilled) notFulfilled = priority; /******/ } /******/ } /******/ if(fulfilled) { /******/ deferred.splice(i--, 1) /******/ var r = fn(); /******/ if (r !== undefined) result = r; /******/ } /******/ } /******/ return result; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/jsonp chunk loading */ /******/ (() => { /******/ // no baseURI /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "rogue-engine-user-scripts": 0 /******/ }; /******/ /******/ // no chunk on demand loading /******/ /******/ // no prefetching /******/ /******/ // no preloaded /******/ /******/ // no HMR /******/ /******/ // no HMR manifest /******/ /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0; /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { /******/ for(moduleId in moreModules) { /******/ if(__webpack_require__.o(moreModules, moduleId)) { /******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(runtime) var result = runtime(__webpack_require__); /******/ } /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ installedChunks[chunkId][0](); /******/ } /******/ installedChunks[chunkId] = 0; /******/ } /******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunk_name_"] = self["webpackChunk_name_"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); /******/ })(); /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ __webpack_require__("./Assets/Components/CombatLogic.re.js"); /******/ __webpack_require__("./Assets/Components/FloatObject.re.js"); /******/ __webpack_require__("./Assets/Components/HouseRaycastReceiver.re.js"); /******/ __webpack_require__("./Assets/Components/Library/AsyncLoader.js"); /******/ __webpack_require__("./Assets/Components/Library/Easings.js"); /******/ __webpack_require__("./Assets/Components/Library/GameData.js"); /******/ __webpack_require__("./Assets/Components/Library/SimpleTweens.js"); /******/ __webpack_require__("./Assets/Components/OrbitCamera.re.js"); /******/ __webpack_require__("./Assets/Components/ParticleSystem.re.js"); /******/ __webpack_require__("./Assets/Components/Pathway.re.js"); /******/ __webpack_require__("./Assets/Components/RaycastReceiver.re.js"); /******/ __webpack_require__("./Assets/Components/RaycastReporter.re.js"); /******/ __webpack_require__("./Assets/Components/SceneLinkRaycastReceiver.re.js"); /******/ __webpack_require__("./Assets/Components/ScrollObject.re.js"); /******/ __webpack_require__("./Assets/Components/ScrollTexture.re.js"); /******/ __webpack_require__("./Assets/Components/TileRaycastReceiver.re.js"); /******/ var __webpack_exports__ = __webpack_require__("./Assets/Components/TitleScreenControl.re.js"); /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); /******/ /******/ return __webpack_exports__; /******/ })() ; }); //# sourceMappingURL=rogue-engine-user-scripts.js.map