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 maxWeaponLengthUpgrades = 0;
public maxWeaponDamageUpgrades = 0; public maxWeaponDamageUpgrades = 0;
public maxHorizontalProjectileUpgrades = 0; public maxHorizontalProjectileUpgrades = 0;
public maxVerticalProjectileUpgrades = 0; public maxHorizontalProjectileUpgrades = 0;
public maxHaloProjectileUpgrades = 0; public maxHaloProjectileUpgrades = 0;
public maxRegenerationUpgrades = 0; public maxRegenerationUpgrades = 0;
} }

View File

@ -14,7 +14,7 @@ import { EnemyManager } from "./Unit/Enemy/EnemyManager";
import { Player } from "./Unit/Player/Player"; import { Player } from "./Unit/Player/Player";
import { HaloProjectileLauncher } from "./Unit/Player/ProjectileLauncher/HaloProjectileLauncher"; import { HaloProjectileLauncher } from "./Unit/Player/ProjectileLauncher/HaloProjectileLauncher";
import { ProjectileLauncher } from "./Unit/Player/ProjectileLauncher/ProjectileLauncher"; 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"; import { Upgrader } from "./Upgrades/Upgrader";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ -33,7 +33,7 @@ export class GameBootstrapper extends Component {
private playerCollisionSystem: PlayerCollisionSystem; private playerCollisionSystem: PlayerCollisionSystem;
private haloProjectileLauncher: HaloProjectileLauncher; private haloProjectileLauncher: HaloProjectileLauncher;
private verticalProjectileLauncher: VerticalProjectileLauncher; private horizontalProjectileLauncher: HorizontalProjectileLauncher;
private gamePauser: Pauser = new Pauser(); private gamePauser: Pauser = new Pauser();
@ -50,9 +50,6 @@ export class GameBootstrapper extends Component {
this.playerCollisionSystem = new PlayerCollisionSystem(this.player, settings.player.collisionDelay); this.playerCollisionSystem = new PlayerCollisionSystem(this.player, settings.player.collisionDelay);
new WeaponCollisionSystem(this.player.Weapon); 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.enemyManager.init(this.player.node);
this.haloProjectileLauncher = new HaloProjectileLauncher( this.haloProjectileLauncher = new HaloProjectileLauncher(
@ -62,14 +59,17 @@ export class GameBootstrapper extends Component {
); );
this.haloProjectileLauncher.upgrade(); this.haloProjectileLauncher.upgrade();
this.verticalProjectileLauncher = new VerticalProjectileLauncher( this.horizontalProjectileLauncher = new HorizontalProjectileLauncher(
this.verticalProjectileLauncherComponent, this.verticalProjectileLauncherComponent,
this.player.node, this.player.node,
settings.player.xyLaunchers 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); this.gameUI.init(this.player);
} }
@ -81,7 +81,7 @@ export class GameBootstrapper extends Component {
this.playerCollisionSystem.gameTick(deltaTime); this.playerCollisionSystem.gameTick(deltaTime);
this.enemyManager.gameTick(deltaTime); this.enemyManager.gameTick(deltaTime);
this.haloProjectileLauncher.gameTick(deltaTime); this.haloProjectileLauncher.gameTick(deltaTime);
this.verticalProjectileLauncher.gameTick(deltaTime); this.horizontalProjectileLauncher.gameTick(deltaTime);
this.camera.node.worldPosition = this.player.node.worldPosition; 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 { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
import { ProjectileLauncher } from "./ProjectileLauncher"; import { ProjectileLauncher } from "./ProjectileLauncher";
export class VerticalProjectileLauncher implements IProjectileCollisionSignaler { export class HorizontalProjectileLauncher implements IProjectileCollisionSignaler {
private currentUpgrade = 0; private currentUpgrade = 0;
private wavesToShootPerUpgrade = 0; private wavesToShootPerUpgrade = 0;

View File

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

View File

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