Diagonal projectile launcher

This commit is contained in:
Martin 2022-12-01 12:16:52 +01:00
parent ab4935403e
commit 772a5cc7e0
7 changed files with 381 additions and 294 deletions

View File

@ -30,7 +30,17 @@
"cooldown": 10
}
},
"xyLaunchers": {
"horizontalLauncher": {
"wavesToShootPerUpgrade": 1,
"launcher": {
"projectileLifetime": 3,
"projectileSpeed": 300,
"wavesToShoot": 0,
"wavesDelayMs": 100,
"cooldown": 4
}
},
"diagonalLauncher": {
"wavesToShootPerUpgrade": 1,
"launcher": {
"projectileLifetime": 20,
@ -45,7 +55,7 @@
"maxWeaponLengthUpgrades": 5,
"maxWeaponDamageUpgrades": 5,
"maxHorizontalProjectileUpgrades": 0,
"maxVerticalProjectileUpgrades": 0,
"maxDiagonalProjectileUpgrades": 0,
"maxHaloProjectileUpgrades": 5,
"maxRegenerationUpgrades": 5
}

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,8 @@ export class PlayerSettings {
public collisionDelay = 0;
public weapon: WeaponSettings = new WeaponSettings();
public haloLauncher: HaloLauncherSettings = new HaloLauncherSettings();
public xyLaunchers: WaveLauncherSettings = new WaveLauncherSettings();
public horizontalLauncher: WaveLauncherSettings = new WaveLauncherSettings();
public diagonalLauncher: WaveLauncherSettings = new WaveLauncherSettings();
}
export class WeaponSettings {
@ -41,7 +42,7 @@ export class UpgradeSettings {
public maxWeaponLengthUpgrades = 0;
public maxWeaponDamageUpgrades = 0;
public maxHorizontalProjectileUpgrades = 0;
public maxHorizontalProjectileUpgrades = 0;
public maxDiagonalProjectileUpgrades = 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 { HorizontalProjectileLauncher } from "./Unit/Player/ProjectileLauncher/HorizontalProjectileLauncher";
import { WaveProjectileLauncher } from "./Unit/Player/ProjectileLauncher/WaveProjectileLauncher";
import { Upgrader } from "./Upgrades/Upgrader";
const { ccclass, property } = _decorator;
@ -24,7 +24,8 @@ export class GameBootstrapper extends Component {
@property(VirtualJoystic) private virtualJoystic: VirtualJoystic;
@property(Player) private player: Player;
@property(ProjectileLauncher) private haloProjectileLauncherComponent: ProjectileLauncher;
@property(ProjectileLauncher) private verticalProjectileLauncherComponent: ProjectileLauncher;
@property(ProjectileLauncher) private horizontalProjectileLauncherComponent: ProjectileLauncher;
@property(ProjectileLauncher) private diagonalProjectileLauncherComponent: ProjectileLauncher;
@property(EnemyManager) private enemyManager: EnemyManager;
@property(Camera) private camera: Camera;
@property(GameUI) private gameUI: GameUI;
@ -33,7 +34,8 @@ export class GameBootstrapper extends Component {
private playerCollisionSystem: PlayerCollisionSystem;
private haloProjectileLauncher: HaloProjectileLauncher;
private horizontalProjectileLauncher: HorizontalProjectileLauncher;
private horizontalProjectileLauncher: WaveProjectileLauncher;
private diagonalProjectileLauncher: WaveProjectileLauncher;
private gamePauser: Pauser = new Pauser();
@ -59,14 +61,23 @@ export class GameBootstrapper extends Component {
);
this.haloProjectileLauncher.upgrade();
this.horizontalProjectileLauncher = new HorizontalProjectileLauncher(
this.verticalProjectileLauncherComponent,
this.horizontalProjectileLauncher = new WaveProjectileLauncher(
this.horizontalProjectileLauncherComponent,
this.player.node,
settings.player.xyLaunchers
[new Vec2(-1, 0), new Vec2(1, 0)],
settings.player.horizontalLauncher
);
this.horizontalProjectileLauncher.upgrade();
new PlayerProjectileCollisionSystem([this.haloProjectileLauncher, this.horizontalProjectileLauncher]);
this.diagonalProjectileLauncher = new WaveProjectileLauncher(
this.diagonalProjectileLauncherComponent,
this.player.node,
[new Vec2(-0.5, -0.5), new Vec2(0.5, -0.5)],
settings.player.diagonalLauncher
);
this.diagonalProjectileLauncher.upgrade();
new PlayerProjectileCollisionSystem([this.haloProjectileLauncher, this.horizontalProjectileLauncher, this.diagonalProjectileLauncher]);
const upgrader = new Upgrader(this.player, this.horizontalProjectileLauncher, this.haloProjectileLauncher, settings.upgrades);
new GameModalLauncher(this.modalWindowManager, this.player, this.gamePauser, upgrader);
@ -82,6 +93,7 @@ export class GameBootstrapper extends Component {
this.enemyManager.gameTick(deltaTime);
this.haloProjectileLauncher.gameTick(deltaTime);
this.horizontalProjectileLauncher.gameTick(deltaTime);
this.diagonalProjectileLauncher.gameTick(deltaTime);
this.camera.node.worldPosition = this.player.node.worldPosition;
}

View File

@ -5,13 +5,13 @@ import { IProjectileCollisionSignaler } from "../../../Projectile/IProjectileCol
import { ProjectileCollision } from "../../../Projectile/ProjectileCollision";
import { ProjectileLauncher } from "./ProjectileLauncher";
export class HorizontalProjectileLauncher implements IProjectileCollisionSignaler {
export class WaveProjectileLauncher implements IProjectileCollisionSignaler {
private currentUpgrade = 0;
private wavesToShootPerUpgrade = 0;
public constructor(private launcher: ProjectileLauncher, playerNode: Node, settings: WaveLauncherSettings) {
public constructor(private launcher: ProjectileLauncher, playerNode: Node, directions: Vec2[], settings: WaveLauncherSettings) {
this.wavesToShootPerUpgrade = settings.wavesToShootPerUpgrade;
launcher.init(playerNode, [new Vec2(-1, 0), new Vec2(1, 0)], settings.launcher);
launcher.init(playerNode, directions, settings.launcher);
}
public get ProjectileCollisionEvent(): ISignal<ProjectileCollision> {

View File

@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "1e160c96-efda-4b1a-8e21-8c1b525bc7ef",
"uuid": "1ed6eff1-da2e-4727-8f44-2e802848719c",
"files": [],
"subMetas": {},
"userData": {}

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 { HorizontalProjectileLauncher } from "../Unit/Player/ProjectileLauncher/HorizontalProjectileLauncher";
import { WaveProjectileLauncher } from "../Unit/Player/ProjectileLauncher/WaveProjectileLauncher";
import { UpgradeType } from "./UpgradeType";
export class Upgrader {
@ -11,7 +11,7 @@ export class Upgrader {
public constructor(
private player: Player,
private horizontalProjectileLauncher: HorizontalProjectileLauncher,
private horizontalProjectileLauncher: WaveProjectileLauncher,
private haloProjectileLauncher: HaloProjectileLauncher,
settings: UpgradeSettings
) {