migrate from perforce
This commit is contained in:
58
dist/Vis/VisEnemy.js
vendored
Normal file
58
dist/Vis/VisEnemy.js
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { EEnemySize } from "../GameData/index.js";
|
||||
import { Vector2 } from "../Util/index.js";
|
||||
export class VisEnemy {
|
||||
_positions;
|
||||
_directions;
|
||||
_image;
|
||||
_context;
|
||||
_simEnemy;
|
||||
_angle = null;
|
||||
_gdRoot;
|
||||
constructor(gdRoot, simEnemy, width, height) {
|
||||
this._gdRoot = gdRoot;
|
||||
this._simEnemy = simEnemy;
|
||||
this._image = document.createElement("canvas");
|
||||
this._image.width = width;
|
||||
this._image.height = height;
|
||||
this._context = this._image.getContext("2d");
|
||||
this._positions = [simEnemy.position, simEnemy.position];
|
||||
this._directions = [simEnemy.direction, simEnemy.direction];
|
||||
}
|
||||
get positions() {
|
||||
return this._positions;
|
||||
}
|
||||
get image() {
|
||||
return this._image;
|
||||
}
|
||||
advanceStep() {
|
||||
const prevPos = this._positions[1];
|
||||
const prevDir = this._directions[1];
|
||||
this._positions = [prevPos, this._simEnemy.position];
|
||||
this._directions = [prevDir, this._simEnemy.direction];
|
||||
}
|
||||
update(t) {
|
||||
const directions = this._directions;
|
||||
const dir = Vector2.lerp(directions[0], directions[1], t);
|
||||
const angle = Math.atan2(dir.x, -dir.y) - Math.PI / 2;
|
||||
if (this._angle == angle) {
|
||||
return;
|
||||
}
|
||||
this._angle = angle;
|
||||
const ctx = this._context;
|
||||
ctx.clearRect(0, 0, this._image.width, this._image.height);
|
||||
ctx.save();
|
||||
ctx.translate(this._image.width / 2, this._image.height / 2);
|
||||
ctx.rotate(angle);
|
||||
switch (this._simEnemy.size) {
|
||||
case EEnemySize.Tiny:
|
||||
ctx.scale(0.75, 0.75);
|
||||
break;
|
||||
case EEnemySize.Huge:
|
||||
ctx.scale(2, 2);
|
||||
break;
|
||||
}
|
||||
ctx.drawImage(this._gdRoot.image("enemy-" + (this._simEnemy.index | 0) + ".svg"), -this._image.width / 2, -this._image.height / 2, this._image.width, this._image.height);
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=VisEnemy.js.map
|
||||
1
dist/Vis/VisEnemy.js.map
vendored
Normal file
1
dist/Vis/VisEnemy.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"VisEnemy.js","sourceRoot":"","sources":["../../src/Vis/VisEnemy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAU,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,OAAO,QAAQ;IACT,UAAU,CAAY;IACtB,WAAW,CAAY;IACvB,MAAM,CAAoB;IAC1B,QAAQ,CAA2B;IACnC,SAAS,CAAW;IACpB,MAAM,GAAkB,IAAI,CAAC;IAC7B,OAAO,CAAS;IAExB,YAAY,MAAc,EAAE,QAAkB,EAAE,KAAa,EAAE,MAAc;QACzE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAE,CAAC;QAC9C,IAAI,CAAC,UAAU,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;IAED,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,I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AM,CAAC,KAAK,CAAC,CAAC;QAClB,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YAC1B,KAAK,UAAU,CAAC,IAAI;gBAChB,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACtB,MAAM;YACV,KAAK,UAAU,CAAC,IAAI;gBAChB,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAChB,MAAM;QACd,CAAC;QACD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1K,GAAG,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACJ"}
|
||||
225
dist/Vis/VisLevel.js
vendored
Normal file
225
dist/Vis/VisLevel.js
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
import { ECellType } from "../Simulation/index.js";
|
||||
import { Hex, Vector2 } from "../Util/index.js";
|
||||
import { VisEnemy, VisProjectile } from "./index.js";
|
||||
export class VisLevel {
|
||||
_screenCellWidth = -1;
|
||||
_screenCellHeight = -1;
|
||||
_screenXOffset = -1;
|
||||
_screenYOffset = -1;
|
||||
_hexSize = -1;
|
||||
_lastStep = -1;
|
||||
_projectileMap;
|
||||
_enemyMap;
|
||||
_background = null;
|
||||
_simLevel = null;
|
||||
_visMain;
|
||||
_simMain;
|
||||
_gdRoot;
|
||||
constructor(visMain, simMain, gdRoot) {
|
||||
this._visMain = visMain;
|
||||
this._simMain = visMain.simMain;
|
||||
this._gdRoot = gdRoot;
|
||||
this._enemyMap = new Map();
|
||||
this._projectileMap = new Map();
|
||||
this.reset();
|
||||
}
|
||||
reset() {
|
||||
this._projectileMap.clear();
|
||||
this._enemyMap.clear();
|
||||
this._background = null;
|
||||
}
|
||||
draw() {
|
||||
const ctx = this._visMain.context;
|
||||
const simLevel = this._simMain.currentLevel;
|
||||
if (simLevel != this._simLevel) {
|
||||
this.reset();
|
||||
this._simLevel = simLevel;
|
||||
}
|
||||
this.drawBackground();
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
simLevel.simCells.forEach((cell) => {
|
||||
if (cell.distance > simLevel.gdLevel.radius) {
|
||||
return;
|
||||
}
|
||||
this.drawCell(cell);
|
||||
});
|
||||
simLevel.simEnemies.forEach((enemy) => {
|
||||
this.drawEnemy(enemy);
|
||||
});
|
||||
simLevel.simProjectiles.forEach((projectile) => {
|
||||
this.drawProjectile(projectile);
|
||||
});
|
||||
ctx.fillStyle = "white";
|
||||
ctx.fillText("Currency: " + simLevel.currency, 5, 15);
|
||||
ctx.fillText("Current wave: " + simLevel.currentWave, 5, 35);
|
||||
ctx.fillText("Enemies left: " + simLevel.enemiesLeftToSpawn, 5, 55);
|
||||
ctx.fillText("Current step: " + simLevel.currentStep, 5, 75);
|
||||
}
|
||||
updateSize() {
|
||||
const gdLevel = this._simMain.currentLevel.gdLevel;
|
||||
const minSize = Math.min(this._visMain.canvas.height, this._visMain.canvas.width * Math.sqrt(3) / 2);
|
||||
this._hexSize = Math.floor(minSize / (4 * (gdLevel.radius - 1) - 4));
|
||||
this._screenCellHeight = Math.ceil(2 * this._hexSize);
|
||||
this._screenCellHeight = Math.ceil(this._screenCellHeight * 0.5) * 2;
|
||||
this._screenCellWidth = Math.ceil(Math.sqrt(3) / 2 * this._screenCellHeight);
|
||||
this._screenCellWidth = Math.ceil(this._screenCellWidth * 0.5) * 2;
|
||||
this._screenXOffset = this._screenCellWidth * (gdLevel.radius + 0.5);
|
||||
this._screenYOffset = this._screenCellHeight * (gdLevel.radius + 0.5);
|
||||
const width = this._screenCellWidth * (gdLevel.radius * 2 + 1);
|
||||
const height = this._screenCellHeight * (gdLevel.radius * 2 + 1);
|
||||
this._screenXOffset += (this._visMain.canvas.width - width) * 0.5;
|
||||
this._screenYOffset += (this._visMain.canvas.height - height) * 0.5;
|
||||
this._screenXOffset = Math.floor(this._screenXOffset);
|
||||
this._screenYOffset = Math.floor(this._screenYOffset);
|
||||
this._background = null;
|
||||
this._enemyMap.clear();
|
||||
}
|
||||
updateEveryFrame(currentStep) {
|
||||
const simLevel = this._simMain.currentLevel;
|
||||
const t = currentStep - Math.floor(currentStep);
|
||||
const deadEnemies = [];
|
||||
simLevel.simEnemies.forEach((simEnemy) => {
|
||||
if (simEnemy.dead) {
|
||||
deadEnemies.push(simEnemy);
|
||||
return;
|
||||
}
|
||||
const visEnemy = this._enemyMap.get(simEnemy);
|
||||
if (!visEnemy) {
|
||||
this._enemyMap.set(simEnemy, new VisEnemy(this._gdRoot, simEnemy, this._screenCellWidth, this._screenCellHeight));
|
||||
}
|
||||
else if (Math.floor(currentStep) != Math.floor(this._lastStep)) {
|
||||
visEnemy.advanceStep();
|
||||
}
|
||||
else {
|
||||
visEnemy.update(t);
|
||||
}
|
||||
});
|
||||
for (const deadEnemy of deadEnemies) {
|
||||
this._enemyMap.delete(deadEnemy);
|
||||
}
|
||||
const deadProjectiles = [];
|
||||
simLevel.simProjectiles.forEach((simProjectile) => {
|
||||
if (simProjectile.dead) {
|
||||
deadProjectiles.push(simProjectile);
|
||||
return;
|
||||
}
|
||||
const visProjectile = this._projectileMap.get(simProjectile);
|
||||
if (!visProjectile) {
|
||||
this._projectileMap.set(simProjectile, new VisProjectile(simProjectile));
|
||||
}
|
||||
else if (Math.floor(currentStep) != Math.floor(this._lastStep)) {
|
||||
visProjectile.advanceStep();
|
||||
}
|
||||
});
|
||||
for (const deadProjectile of deadProjectiles) {
|
||||
this._projectileMap.delete(deadProjectile);
|
||||
}
|
||||
this._lastStep = currentStep;
|
||||
}
|
||||
getScreenCoords(hex) {
|
||||
const coord = Hex.toPixel(hex, this._hexSize);
|
||||
return new Vector2(coord.x + this._screenXOffset - this._screenCellWidth / 2, coord.y + this._screenYOffset - this._screenCellHeight / 2);
|
||||
}
|
||||
getHexFromScreenCoords(coords) {
|
||||
const x = coords.x - this._screenXOffset;
|
||||
const y = coords.y - this._screenYOffset;
|
||||
return Hex.fromPixel(new Vector2(x, y), this._hexSize);
|
||||
}
|
||||
drawBackground() {
|
||||
const ctx = this._visMain.context;
|
||||
const simLevel = this._simMain.currentLevel;
|
||||
if (this._background == null) {
|
||||
const backgroundCanvas = this._visMain.canvas.cloneNode();
|
||||
const backgroundContext = backgroundCanvas.getContext("2d");
|
||||
this._background = backgroundCanvas;
|
||||
simLevel.simCells.forEach((cell) => {
|
||||
if (cell.distance > simLevel.gdLevel.radius) {
|
||||
return;
|
||||
}
|
||||
if (cell.blockedType != -1 && cell.type == ECellType.Blocked) {
|
||||
this.drawCellImage(backgroundContext, cell, "cell-blocked-" + (cell.blockedType | 0) + ".svg");
|
||||
}
|
||||
});
|
||||
backgroundContext.globalCompositeOperation = "source-atop";
|
||||
backgroundContext.fillStyle = this._visMain.wallPattern;
|
||||
backgroundContext.fillRect(0, 0, this._visMain.canvas.width, this._visMain.canvas.height);
|
||||
const cellCanvas = this._visMain.canvas.cloneNode();
|
||||
const cellContext = cellCanvas.getContext("2d");
|
||||
simLevel.simCells.forEach((cell) => {
|
||||
if (cell.distance > simLevel.gdLevel.radius) {
|
||||
return;
|
||||
}
|
||||
if (cell.type != ECellType.Entry) {
|
||||
this.drawCellImage(cellContext, cell, "cell.svg");
|
||||
}
|
||||
});
|
||||
backgroundContext.globalCompositeOperation = "destination-over";
|
||||
backgroundContext.drawImage(cellCanvas, 0, 0);
|
||||
backgroundContext.globalCompositeOperation = "source-over";
|
||||
}
|
||||
ctx.drawImage(this._background, 0, 0);
|
||||
}
|
||||
drawProjectile(simProjectile) {
|
||||
const visProjectile = this._projectileMap.get(simProjectile);
|
||||
if (!visProjectile) {
|
||||
return;
|
||||
}
|
||||
const t = this._lastStep - Math.floor(this._lastStep);
|
||||
const positions = visProjectile.positions;
|
||||
if (!positions) {
|
||||
return;
|
||||
}
|
||||
const pos = Vector2.lerp(positions[0], positions[1], t);
|
||||
const width = this._screenCellWidth * simProjectile.size;
|
||||
const height = this._screenCellHeight * simProjectile.size;
|
||||
this._visMain.context.drawImage(this._gdRoot.image("projectile.svg"), this._screenXOffset + pos.x * this._hexSize - width / 2, this._screenYOffset + pos.y * this._hexSize - height / 2, width, height);
|
||||
}
|
||||
drawEnemy(simEnemy) {
|
||||
const visEnemy = this._enemyMap.get(simEnemy);
|
||||
if (!visEnemy) {
|
||||
return;
|
||||
}
|
||||
const t = this._lastStep - Math.floor(this._lastStep);
|
||||
const positions = visEnemy.positions;
|
||||
if (!positions) {
|
||||
return;
|
||||
}
|
||||
const pos = Vector2.lerp(positions[0], positions[1], t);
|
||||
this._visMain.context.drawImage(visEnemy.image, this._screenXOffset + pos.x * this._hexSize - this._screenCellWidth / 2, this._screenYOffset + pos.y * this._hexSize - this._screenCellHeight / 2, this._screenCellWidth, this._screenCellHeight);
|
||||
}
|
||||
drawCell(cell) {
|
||||
this._visMain.context.fillStyle = "rgba(192, 192, 192, 0.25)";
|
||||
if (cell.type == ECellType.Entry) {
|
||||
this.drawCellImage(this._visMain.context, cell, "cell-entry-" + (cell.blockedType | 0) + ".svg");
|
||||
}
|
||||
const simLevel = this._simMain.currentLevel;
|
||||
const highlightedCell = simLevel.simCells[simLevel.highlightedIndex];
|
||||
if (!!highlightedCell) {
|
||||
let draw = highlightedCell.index == cell.index;
|
||||
if (draw && highlightedCell.pathsToTarget != null) {
|
||||
for (const routeIdx in highlightedCell.pathsToTarget) {
|
||||
for (const idx in highlightedCell.pathsToTarget[routeIdx]) {
|
||||
if (highlightedCell.pathsToTarget[routeIdx][idx] == highlightedCell.index) {
|
||||
draw = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (draw) {
|
||||
this.drawCellImage(this._visMain.context, highlightedCell, "cell-highlighted.svg");
|
||||
this._visMain.context.fillStyle = "rgba(0, 0, 0, 1)";
|
||||
}
|
||||
}
|
||||
if (cell.simTower != null) {
|
||||
this.drawCellImage(this._visMain.context, cell, "tower-" + (cell.simTower.index | 0) + ".svg");
|
||||
}
|
||||
const coords = this.getScreenCoords(cell.hex);
|
||||
this._visMain.context.fillText("(" + cell.hex.col + ", " + cell.hex.row + ")", coords.x + 10, coords.y + this._screenCellHeight / 2 + 5);
|
||||
}
|
||||
drawCellImage(context, cell, name) {
|
||||
const coords = this.getScreenCoords(cell.hex);
|
||||
context.drawImage(this._gdRoot.image(name), coords.x, coords.y, this._screenCellWidth, this._screenCellHeight);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=VisLevel.js.map
|
||||
1
dist/Vis/VisLevel.js.map
vendored
Normal file
1
dist/Vis/VisLevel.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
103
dist/Vis/VisMain.js
vendored
Normal file
103
dist/Vis/VisMain.js
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
import { VisLevel } from "./index.js";
|
||||
export class VisMain {
|
||||
_canvas;
|
||||
_context;
|
||||
_startTimestamp = 0;
|
||||
_active = true;
|
||||
_ready = false;
|
||||
_gap = 0;
|
||||
_wallPattern;
|
||||
_visLevel;
|
||||
_simMain;
|
||||
constructor(simMain, canvas) {
|
||||
this._simMain = simMain;
|
||||
this._canvas = canvas;
|
||||
this._context = this._canvas.getContext("2d");
|
||||
this._context.globalCompositeOperation = "source-over";
|
||||
this._wallPattern = this.createPattern(this._simMain.gdRoot.image("wall.png"), 48);
|
||||
this._visLevel = new VisLevel(this, this._simMain, this._simMain.gdRoot);
|
||||
const host = this;
|
||||
requestAnimationFrame(function step(timestamp) {
|
||||
host.step(timestamp);
|
||||
});
|
||||
}
|
||||
get simMain() {
|
||||
return this._simMain;
|
||||
}
|
||||
get visLevel() {
|
||||
return this._visLevel;
|
||||
}
|
||||
get canvas() {
|
||||
return this._canvas;
|
||||
}
|
||||
get context() {
|
||||
return this._context;
|
||||
}
|
||||
get wallPattern() {
|
||||
return this._wallPattern;
|
||||
}
|
||||
createPattern(image, size) {
|
||||
const tempCanvas = document.createElement("canvas");
|
||||
const tempContext = tempCanvas.getContext("2d");
|
||||
tempCanvas.width = size;
|
||||
tempCanvas.height = size;
|
||||
tempContext.drawImage(image, 0, 0, image.width, image.height, 0, 0, size, size);
|
||||
return this._context.createPattern(tempCanvas, 'repeat');
|
||||
}
|
||||
step(timestamp) {
|
||||
if (!this._active) {
|
||||
return;
|
||||
}
|
||||
const host = this;
|
||||
requestAnimationFrame((timestamp) => {
|
||||
host.step(timestamp);
|
||||
});
|
||||
if (!this._startTimestamp) {
|
||||
this._startTimestamp = timestamp;
|
||||
}
|
||||
const simLevel = this._simMain.currentLevel;
|
||||
let targetStep = (timestamp - this._startTimestamp) * this._simMain.gdRoot.simulation.stepsPerSecond / 1000 - this._gap;
|
||||
if (simLevel.paused) {
|
||||
this._gap += targetStep - simLevel.currentStep;
|
||||
targetStep = simLevel.currentStep;
|
||||
}
|
||||
this._simMain.executeUntilStep(targetStep);
|
||||
this._visLevel.updateEveryFrame(targetStep);
|
||||
this.onRender();
|
||||
}
|
||||
;
|
||||
onResized() {
|
||||
const gameHost = document.getElementById("game-host");
|
||||
const width = gameHost.clientWidth;
|
||||
const height = gameHost.clientHeight;
|
||||
const ratio = window.devicePixelRatio;
|
||||
this._canvas.width = width * ratio;
|
||||
this._canvas.height = height * ratio;
|
||||
this._canvas.style.width = width + "px";
|
||||
this._canvas.style.height = height + "px";
|
||||
this._context.scale(ratio, ratio);
|
||||
this._visLevel.updateSize();
|
||||
}
|
||||
;
|
||||
onRender() {
|
||||
this.clear();
|
||||
const ctx = this._context;
|
||||
ctx.font = "12px Tahoma";
|
||||
const simLevel = this._simMain.currentLevel;
|
||||
if (!!simLevel) {
|
||||
if (!this._ready) {
|
||||
this.onResized();
|
||||
this._ready = true;
|
||||
}
|
||||
this._visLevel.draw();
|
||||
}
|
||||
}
|
||||
;
|
||||
clear() {
|
||||
this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||
}
|
||||
stop() {
|
||||
this._active = false;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=VisMain.js.map
|
||||
1
dist/Vis/VisMain.js.map
vendored
Normal file
1
dist/Vis/VisMain.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"VisMain.js","sourceRoot":"","sources":["../../src/Vis/VisMain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,OAAO,OAAO;IACR,OAAO,CAAoB;IAC3B,QAAQ,CAA2B;IACnC,eAAe,GAAW,CAAC,CAAC;IAC5B,OAAO,GAAY,IAAI,CAAC;IACxB,MAAM,GAAY,KAAK,CAAC;IACxB,IAAI,GAAW,CAAC,CAAC;IACjB,YAAY,CAAgB;IAC5B,SAAS,CAAW;IACpB,QAAQ,CAAU;IAE1B,YAAY,OAAgB,EAAE,MAAyB;QACnD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,wBAAwB,GAAG,aAAa,CAAC;QACvD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,SAAS,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzE,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,qB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,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IAAA,CAAC;IAEM,QAAQ;QACZ,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC1B,GAAG,CAAC,IAAI,GAAG,aAAa,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC5C,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,EAAE,CAAC;gBACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACvB,CAAC;YACD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAC1B,CAAC;IACL,CAAC;IAAA,CAAC;IAEM,KAAK;QACT,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC;IAEO,IAAI;QACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;CACJ"}
|
||||
15
dist/Vis/VisProjectile.js
vendored
Normal file
15
dist/Vis/VisProjectile.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export class VisProjectile {
|
||||
_positions;
|
||||
_simProjectile;
|
||||
constructor(simProjectile) {
|
||||
this._simProjectile = simProjectile;
|
||||
this._positions = [simProjectile.position, simProjectile.position];
|
||||
}
|
||||
get positions() {
|
||||
return this._positions;
|
||||
}
|
||||
advanceStep() {
|
||||
this._positions = [this._positions[1], this._simProjectile.position];
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=VisProjectile.js.map
|
||||
1
dist/Vis/VisProjectile.js.map
vendored
Normal file
1
dist/Vis/VisProjectile.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"VisProjectile.js","sourceRoot":"","sources":["../../src/Vis/VisProjectile.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAa;IACd,UAAU,CAAY;IACtB,cAAc,CAAgB;IAEtC,YAAY,aAA4B;QACpC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC;IAED,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAEM,WAAW;QACd,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACzE,CAAC;CACJ"}
|
||||
6
dist/Vis/index.js
vendored
Normal file
6
dist/Vis/index.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { VisEnemy } from "./VisEnemy.js";
|
||||
import { VisLevel } from "./VisLevel.js";
|
||||
import { VisMain } from "./VisMain.js";
|
||||
import { VisProjectile } from "./VisProjectile.js";
|
||||
export { VisEnemy, VisLevel, VisMain, VisProjectile };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dist/Vis/index.js.map
vendored
Normal file
1
dist/Vis/index.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Vis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
||||
Reference in New Issue
Block a user