Projectile piercing, meta upgrades

This commit is contained in:
Martin
2022-12-13 11:58:40 +01:00
parent e626d493d2
commit 39775b2a65
15 changed files with 201 additions and 35 deletions

View File

@@ -1,11 +1,19 @@
import { Component, _decorator } from "cc";
import { CCInteger, Component, _decorator } from "cc";
import { GameRunner } from "../Menu/GameRunner";
import { delay } from "../Services/Utils/AsyncUtils";
import { UserData } from "./Data/UserData";
import { Game } from "./Game";
const { ccclass } = _decorator;
const { ccclass, property } = _decorator;
@ccclass("TestGameRunner")
export class TestGameRunner extends Component {
@property(CCInteger) private maxHpLevel = 0;
@property(CCInteger) private bonusDamageLevel = 0;
@property(CCInteger) private projectilePiercingLevel = 0;
@property(CCInteger) private movementSpeedLevel = 0;
@property(CCInteger) private xpGathererLevel = 0;
@property(CCInteger) private goldGathererLevel = 0;
public start(): void {
if (GameRunner.Instance.IsRunning) return;
this.playTestGameAsync();
@@ -13,6 +21,14 @@ export class TestGameRunner extends Component {
public async playTestGameAsync(): Promise<void> {
while (Game.Instance == null) await delay(100);
Game.Instance.playGame();
const testUserData = new UserData();
testUserData.game.metaUpgrades.maxHpLevel = this.maxHpLevel;
testUserData.game.metaUpgrades.bonusDamageLevel = this.bonusDamageLevel;
testUserData.game.metaUpgrades.projectilePiercingLevel = this.projectilePiercingLevel;
testUserData.game.metaUpgrades.movementSpeedLevel = this.movementSpeedLevel;
testUserData.game.metaUpgrades.xpGathererLevel = this.xpGathererLevel;
testUserData.game.metaUpgrades.goldGathererLevel = this.goldGathererLevel;
Game.Instance.playGame(testUserData);
}
}