This commit is contained in:
Martin 2022-11-30 16:04:48 +01:00
parent ab39355a5c
commit ab4935403e
6 changed files with 20 additions and 17 deletions

View File

@ -41,7 +41,7 @@ export class UpgradeSettings {
public maxWeaponLengthUpgrades = 0;
public maxWeaponDamageUpgrades = 0;
public maxHorizontalProjectileUpgrades = 0;
public maxVerticalProjectileUpgrades = 0;
public maxHorizontalProjectileUpgrades = 0;
public maxHaloProjectileUpgrades = 0;
public maxRegenerationUpgrades = 0;
}

View File

@ -14,7 +14,7 @@ import { EnemyManager } from "./Unit/Enemy/EnemyManager";
import { Player } from "./Unit/Player/Player";
import { HaloProjectileLauncher } from "./Unit/Player/ProjectileLauncher/HaloProjectileLauncher";
import { ProjectileLauncher } from "./Unit/Player/ProjectileLauncher/ProjectileLauncher";
import { VerticalProjectileLauncher } from "./Unit/Player/ProjectileLauncher/VerticalProjectileLauncher";
import { HorizontalProjectileLauncher } from "./Unit/Player/ProjectileLauncher/HorizontalProjectileLauncher";
import { Upgrader } from "./Upgrades/Upgrader";
const { ccclass, property } = _decorator;
@ -33,7 +33,7 @@ export class GameBootstrapper extends Component {
private playerCollisionSystem: PlayerCollisionSystem;
private haloProjectileLauncher: HaloProjectileLauncher;
private verticalProjectileLauncher: VerticalProjectileLauncher;
private horizontalProjectileLauncher: HorizontalProjectileLauncher;
private gamePauser: Pauser = new Pauser();
@ -50,9 +50,6 @@ export class GameBootstrapper extends Component {
this.playerCollisionSystem = new PlayerCollisionSystem(this.player, settings.player.collisionDelay);
new WeaponCollisionSystem(this.player.Weapon);
const upgrader = new Upgrader(this.player, settings.upgrades);
new GameModalLauncher(this.modalWindowManager, this.player, this.gamePauser, upgrader);
this.enemyManager.init(this.player.node);
this.haloProjectileLauncher = new HaloProjectileLauncher(
@ -62,14 +59,17 @@ export class GameBootstrapper extends Component {
);
this.haloProjectileLauncher.upgrade();
this.verticalProjectileLauncher = new VerticalProjectileLauncher(
this.horizontalProjectileLauncher = new HorizontalProjectileLauncher(
this.verticalProjectileLauncherComponent,
this.player.node,
settings.player.xyLaunchers
);
this.verticalProjectileLauncher.upgrade();
this.horizontalProjectileLauncher.upgrade();
new PlayerProjectileCollisionSystem([this.haloProjectileLauncher, this.verticalProjectileLauncher]);
new PlayerProjectileCollisionSystem([this.haloProjectileLauncher, this.horizontalProjectileLauncher]);
const upgrader = new Upgrader(this.player, this.horizontalProjectileLauncher, this.haloProjectileLauncher, settings.upgrades);
new GameModalLauncher(this.modalWindowManager, this.player, this.gamePauser, upgrader);
this.gameUI.init(this.player);
}
@ -81,7 +81,7 @@ export class GameBootstrapper extends Component {
this.playerCollisionSystem.gameTick(deltaTime);
this.enemyManager.gameTick(deltaTime);
this.haloProjectileLauncher.gameTick(deltaTime);
this.verticalProjectileLauncher.gameTick(deltaTime);
this.horizontalProjectileLauncher.gameTick(deltaTime);
this.camera.node.worldPosition = this.player.node.worldPosition;
}

View File

@ -5,7 +5,7 @@ import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCol
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
import { ProjectileLauncher } from "./ProjectileLauncher";
export class VerticalProjectileLauncher implements IProjectileCollisionSignaler {
export class HorizontalProjectileLauncher implements IProjectileCollisionSignaler {
private currentUpgrade = 0;
private wavesToShootPerUpgrade = 0;

View File

@ -2,7 +2,6 @@ export enum UpgradeType {
WeaponLength,
WeaponDamage,
HorizontalProjectile,
VerticalProjectile,
HaloProjectlie,
Regeneration
}

View File

@ -1,7 +1,7 @@
import { UpgradeSettings } from "../Data/GameSettings";
import { Player } from "../Unit/Player/Player";
import { HaloProjectileLauncher } from "../Unit/Player/ProjectileLauncher/HaloProjectileLauncher";
import { VerticalProjectileLauncher } from "../Unit/Player/ProjectileLauncher/VerticalProjectileLauncher";
import { HorizontalProjectileLauncher } from "../Unit/Player/ProjectileLauncher/HorizontalProjectileLauncher";
import { UpgradeType } from "./UpgradeType";
export class Upgrader {
@ -11,13 +11,17 @@ export class Upgrader {
public constructor(
private player: Player,
private verticalProjectileLauncher: VerticalProjectileLauncher,
private horizontalProjectileLauncher: HorizontalProjectileLauncher,
private haloProjectileLauncher: HaloProjectileLauncher,
settings: UpgradeSettings
) {
this.setTypeMaps(UpgradeType.WeaponLength, this.upgradeWeaponLength.bind(this), settings.maxWeaponLengthUpgrades);
this.setTypeMaps(UpgradeType.WeaponDamage, this.upgradeWeaponDamage.bind(this), settings.maxWeaponDamageUpgrades);
this.setTypeMaps(UpgradeType.VerticalProjectile, this.upgradeVerticalProjectileLauncher.bind(this), settings.maxVerticalProjectileUpgrades);
this.setTypeMaps(
UpgradeType.HorizontalProjectile,
this.upgradeHorizontalProjectileLauncher.bind(this),
settings.maxHorizontalProjectileUpgrades
);
this.setTypeMaps(UpgradeType.HaloProjectlie, this.upgradeHaloProjectileLauncher.bind(this), settings.maxHaloProjectileUpgrades);
this.setTypeMaps(UpgradeType.Regeneration, this.upgradeRegeneration.bind(this), settings.maxRegenerationUpgrades);
}
@ -56,8 +60,8 @@ export class Upgrader {
this.player.Weapon.upgradeWeaponDamage();
}
private upgradeVerticalProjectileLauncher(): void {
this.verticalProjectileLauncher.upgrade();
private upgradeHorizontalProjectileLauncher(): void {
this.horizontalProjectileLauncher.upgrade();
}
private upgradeHaloProjectileLauncher(): void {