mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-26 11:48:54 +00:00
Meta updates
This commit is contained in:
parent
8057a24345
commit
ad1be40f2b
@ -1,209 +1 @@
|
|||||||
{
|
{"player":{"defaultHP":50,"requiredXP":[10,20,30,40,50,60,70,80,90,100],"speed":0,"regenerationDelay":5,"collisionDelay":0.5,"weapon":{"strikeDelay":2.5,"damage":5},"haloLauncher":{"projectilesToSpawn":24,"cooldownDivisorPerUpgrade":1,"launcher":{"projectileLifetime":2,"projectileSpeed":150,"wavesToShoot":1,"wavesDelayMs":0,"cooldown":10}},"horizontalLauncher":{"wavesToShootPerUpgrade":1,"launcher":{"projectileLifetime":3,"projectileSpeed":300,"wavesToShoot":1,"wavesDelayMs":100,"cooldown":4}},"diagonalLauncher":{"wavesToShootPerUpgrade":1,"launcher":{"projectileLifetime":20,"projectileSpeed":300,"wavesToShoot":1,"wavesDelayMs":100,"cooldown":4}}},"upgrades":{"maxWeaponLengthUpgrades":5,"maxWeaponDamageUpgrades":10,"maxHorizontalProjectileUpgrades":0,"maxDiagonalProjectileUpgrades":0,"maxHaloProjectileUpgrades":5,"maxRegenerationUpgrades":5},"metaUpgrades":{"healthPointsPerLevel":0,"bonusDamagePerLevel":0,"projectilePiercingPerLevel":0,"movementSpeedPerLevel":0,"xpBonusPerLevel":0,"goldBonusPerLevel":0},"enemyManager":{"enemies":[{"id":"BasicEnemy","moveType":"Follow","health":3,"damage":1,"speed":60},{"id":"CircleEnemy","moveType":"Follow","health":10,"damage":1,"speed":25},{"id":"WaveEnemy","moveType":"Launch","health":1,"damage":2,"speed":390},{"id":"WaveEnemyArmor","moveType":"Launch","health":7,"damage":3,"speed":70},{"id":"BasicBoss","moveType":"Follow","health":12,"damage":2,"speed":65},{"id":"BasicCheetah","moveType":"PeriodicFollow","health":5,"damage":2,"speed":140}],"individualEnemySpawners":[{"common":{"enemyId":"BasicEnemy","startDelay":0,"stopDelay":29,"cooldown":1}},{"common":{"enemyId":"BasicEnemy","startDelay":30,"stopDelay":59,"cooldown":0.9}},{"common":{"enemyId":"BasicBoss","startDelay":60,"stopDelay":61,"cooldown":0.9}},{"common":{"enemyId":"BasicEnemy","startDelay":62,"stopDelay":120,"cooldown":0.7}},{"common":{"enemyId":"BasicEnemy","startDelay":121,"stopDelay":240,"cooldown":0.5}}],"circularEnemySpawners":[{"common":{"enemyId":"CircleEnemy","startDelay":1,"stopDelay":240,"cooldown":35},"enemiesToSpawn":40},{"common":{"enemyId":"BasicEnemy","startDelay":59,"stopDelay":63,"cooldown":3},"enemiesToSpawn":10},{"common":{"enemyId":"BasicCheetah","startDelay":119,"stopDelay":123,"cooldown":2},"enemiesToSpawn":10}],"waveEnemySpawners":[{"common":{"enemyId":"WaveEnemy","startDelay":1,"stopDelay":-1,"cooldown":20},"enemiesToSpawn":15,"waveLifetime":50},{"common":{"enemyId":"WaveEnemyArmor","startDelay":1,"stopDelay":-1,"cooldown":50},"enemiesToSpawn":12,"waveLifetime":20}]}}
|
||||||
"player": {
|
|
||||||
"defaultHP": 50,
|
|
||||||
"requiredXP": [
|
|
||||||
10,
|
|
||||||
20,
|
|
||||||
30,
|
|
||||||
40,
|
|
||||||
50,
|
|
||||||
60,
|
|
||||||
70,
|
|
||||||
80,
|
|
||||||
90,
|
|
||||||
100
|
|
||||||
],
|
|
||||||
"regenerationDelay": 5,
|
|
||||||
"collisionDelay": 0.5,
|
|
||||||
"weapon": {
|
|
||||||
"strikeDelay": 2.5,
|
|
||||||
"damage": 5
|
|
||||||
},
|
|
||||||
"haloLauncher": {
|
|
||||||
"projectilesToSpawn": 24,
|
|
||||||
"cooldownDivisorPerUpgrade": 1,
|
|
||||||
"launcher": {
|
|
||||||
"projectileLifetime": 2,
|
|
||||||
"projectileSpeed": 150,
|
|
||||||
"wavesToShoot": 1,
|
|
||||||
"wavesDelayMs": 0,
|
|
||||||
"cooldown": 10
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"horizontalLauncher": {
|
|
||||||
"wavesToShootPerUpgrade": 1,
|
|
||||||
"launcher": {
|
|
||||||
"projectileLifetime": 3,
|
|
||||||
"projectileSpeed": 300,
|
|
||||||
"wavesToShoot": 1,
|
|
||||||
"wavesDelayMs": 100,
|
|
||||||
"cooldown": 4
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"diagonalLauncher": {
|
|
||||||
"wavesToShootPerUpgrade": 1,
|
|
||||||
"launcher": {
|
|
||||||
"projectileLifetime": 20,
|
|
||||||
"projectileSpeed": 300,
|
|
||||||
"wavesToShoot": 1,
|
|
||||||
"wavesDelayMs": 100,
|
|
||||||
"cooldown": 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"upgrades": {
|
|
||||||
"maxWeaponLengthUpgrades": 5,
|
|
||||||
"maxWeaponDamageUpgrades": 10,
|
|
||||||
"maxHorizontalProjectileUpgrades": 0,
|
|
||||||
"maxDiagonalProjectileUpgrades": 0,
|
|
||||||
"maxHaloProjectileUpgrades": 5,
|
|
||||||
"maxRegenerationUpgrades": 5
|
|
||||||
},
|
|
||||||
"metaUpgrades": {
|
|
||||||
"healthPointsPerLevel": 0,
|
|
||||||
"bonusDamagePerLevel": 0,
|
|
||||||
"projectilePiercingPerLevel": 0,
|
|
||||||
"movementSpeedPerLevel": 0,
|
|
||||||
"xpBonusPerLevel": 0,
|
|
||||||
"goldBonusPerLevel": 0
|
|
||||||
},
|
|
||||||
"enemyManager": {
|
|
||||||
"enemies": [
|
|
||||||
{
|
|
||||||
"id": "BasicEnemy",
|
|
||||||
"moveType": "Follow",
|
|
||||||
"health": 3,
|
|
||||||
"damage": 1,
|
|
||||||
"speed": 60
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "CircleEnemy",
|
|
||||||
"moveType": "Follow",
|
|
||||||
"health": 10,
|
|
||||||
"damage": 1,
|
|
||||||
"speed": 25
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "WaveEnemy",
|
|
||||||
"moveType": "Launch",
|
|
||||||
"health": 1,
|
|
||||||
"damage": 2,
|
|
||||||
"speed": 390
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "WaveEnemyArmor",
|
|
||||||
"moveType": "Launch",
|
|
||||||
"health": 7,
|
|
||||||
"damage": 3,
|
|
||||||
"speed": 70
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "BasicBoss",
|
|
||||||
"moveType": "Follow",
|
|
||||||
"health": 12,
|
|
||||||
"damage": 2,
|
|
||||||
"speed": 65
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "BasicCheetah",
|
|
||||||
"moveType": "PeriodicFollow",
|
|
||||||
"health": 5,
|
|
||||||
"damage": 2,
|
|
||||||
"speed": 140
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"individualEnemySpawners": [
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "BasicEnemy",
|
|
||||||
"startDelay": 0,
|
|
||||||
"stopDelay": 29,
|
|
||||||
"cooldown": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "BasicEnemy",
|
|
||||||
"startDelay": 30,
|
|
||||||
"stopDelay": 59,
|
|
||||||
"cooldown": 0.9
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "BasicBoss",
|
|
||||||
"startDelay": 60,
|
|
||||||
"stopDelay": 61,
|
|
||||||
"cooldown": 0.9
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "BasicEnemy",
|
|
||||||
"startDelay": 62,
|
|
||||||
"stopDelay": 120,
|
|
||||||
"cooldown": 0.7
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "BasicEnemy",
|
|
||||||
"startDelay": 121,
|
|
||||||
"stopDelay": 240,
|
|
||||||
"cooldown": 0.5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"circularEnemySpawners": [
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "CircleEnemy",
|
|
||||||
"startDelay": 1,
|
|
||||||
"stopDelay": 240,
|
|
||||||
"cooldown": 35
|
|
||||||
},
|
|
||||||
"enemiesToSpawn": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "BasicEnemy",
|
|
||||||
"startDelay": 59,
|
|
||||||
"stopDelay": 63,
|
|
||||||
"cooldown": 3
|
|
||||||
},
|
|
||||||
"enemiesToSpawn": 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "BasicCheetah",
|
|
||||||
"startDelay": 119,
|
|
||||||
"stopDelay": 123,
|
|
||||||
"cooldown": 2
|
|
||||||
},
|
|
||||||
"enemiesToSpawn": 10
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"waveEnemySpawners": [
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "WaveEnemy",
|
|
||||||
"startDelay": 1,
|
|
||||||
"stopDelay": -1,
|
|
||||||
"cooldown": 20
|
|
||||||
},
|
|
||||||
"enemiesToSpawn": 15,
|
|
||||||
"waveLifetime": 50
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"common": {
|
|
||||||
"enemyId": "WaveEnemyArmor",
|
|
||||||
"startDelay": 1,
|
|
||||||
"stopDelay": -1,
|
|
||||||
"cooldown": 50
|
|
||||||
},
|
|
||||||
"enemiesToSpawn": 12,
|
|
||||||
"waveLifetime": 20
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,6 +8,7 @@ export class GameSettings {
|
|||||||
export class PlayerSettings {
|
export class PlayerSettings {
|
||||||
public defaultHP = 0;
|
public defaultHP = 0;
|
||||||
public requiredXP: number[] = [];
|
public requiredXP: number[] = [];
|
||||||
|
public speed = 0;
|
||||||
public regenerationDelay = 0;
|
public regenerationDelay = 0;
|
||||||
public collisionDelay = 0;
|
public collisionDelay = 0;
|
||||||
public weapon: WeaponSettings = new WeaponSettings();
|
public weapon: WeaponSettings = new WeaponSettings();
|
||||||
|
@ -5,7 +5,7 @@ import { Background } from "./Background/Background";
|
|||||||
import { PlayerCollisionSystem } from "./Collision/PlayerCollisionSystem";
|
import { PlayerCollisionSystem } from "./Collision/PlayerCollisionSystem";
|
||||||
import { PlayerProjectileCollisionSystem } from "./Collision/PlayerProjectileCollisionSystem";
|
import { PlayerProjectileCollisionSystem } from "./Collision/PlayerProjectileCollisionSystem";
|
||||||
import { WeaponCollisionSystem } from "./Collision/WeaponCollisionSystem";
|
import { WeaponCollisionSystem } from "./Collision/WeaponCollisionSystem";
|
||||||
import { GameSettings } from "./Data/GameSettings";
|
import { GameSettings, PlayerSettings } from "./Data/GameSettings";
|
||||||
import { UserData } from "./Data/UserData";
|
import { UserData } from "./Data/UserData";
|
||||||
import { KeyboardInput } from "./Input/KeyboardInput";
|
import { KeyboardInput } from "./Input/KeyboardInput";
|
||||||
import { MultiInput } from "./Input/MultiInput";
|
import { MultiInput } from "./Input/MultiInput";
|
||||||
@ -66,13 +66,7 @@ export class Game extends Component {
|
|||||||
const arrowKeys = new KeyboardInput(KeyCode.ARROW_UP, KeyCode.ARROW_DOWN, KeyCode.ARROW_LEFT, KeyCode.ARROW_RIGHT);
|
const arrowKeys = new KeyboardInput(KeyCode.ARROW_UP, KeyCode.ARROW_DOWN, KeyCode.ARROW_LEFT, KeyCode.ARROW_RIGHT);
|
||||||
const multiInput: MultiInput = new MultiInput([this.virtualJoystic, wasd, arrowKeys]);
|
const multiInput: MultiInput = new MultiInput([this.virtualJoystic, wasd, arrowKeys]);
|
||||||
|
|
||||||
const playerData: PlayerData = Object.assign(new PlayerData(), settings.player);
|
this.player.init(multiInput, this.createPlayerData(settings.player, metaUpgrades));
|
||||||
playerData.bonusHp = metaUpgrades.getUpgradeValue(MetaUpgradeType.MaxHp);
|
|
||||||
playerData.bonusDamage = metaUpgrades.getUpgradeValue(MetaUpgradeType.OverallDamage);
|
|
||||||
playerData.bonusSpeed = metaUpgrades.getUpgradeValue(MetaUpgradeType.MovementSpeed);
|
|
||||||
playerData.bonusXP = metaUpgrades.getUpgradeValue(MetaUpgradeType.XPGatherer);
|
|
||||||
playerData.bonusGold = metaUpgrades.getUpgradeValue(MetaUpgradeType.GoldGatherer);
|
|
||||||
this.player.init(multiInput, playerData);
|
|
||||||
|
|
||||||
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);
|
||||||
@ -141,4 +135,20 @@ export class Game extends Component {
|
|||||||
|
|
||||||
this.camera.node.worldPosition = this.player.node.worldPosition;
|
this.camera.node.worldPosition = this.player.node.worldPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private createPlayerData(settings: PlayerSettings, metaUpgrades: MetaUpgrades): PlayerData {
|
||||||
|
const playerData: PlayerData = Object.assign(new PlayerData(), settings);
|
||||||
|
|
||||||
|
playerData.maxHp = metaUpgrades.getUpgradeValue(MetaUpgradeType.MaxHp) + settings.defaultHP;
|
||||||
|
playerData.requiredXP = settings.requiredXP;
|
||||||
|
playerData.speed = metaUpgrades.getUpgradeValue(MetaUpgradeType.MovementSpeed) + settings.speed;
|
||||||
|
playerData.regenerationDelay = settings.regenerationDelay;
|
||||||
|
playerData.xpMultiplier = metaUpgrades.getUpgradeValue(MetaUpgradeType.XPGatherer) + 1;
|
||||||
|
playerData.goldMultiplier = metaUpgrades.getUpgradeValue(MetaUpgradeType.GoldGatherer) + 1;
|
||||||
|
|
||||||
|
playerData.damage = metaUpgrades.getUpgradeValue(MetaUpgradeType.OverallDamage) + settings.weapon.damage;
|
||||||
|
playerData.strikeDelay = settings.weapon.strikeDelay;
|
||||||
|
|
||||||
|
return playerData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { BoxCollider2D, Collider2D, Component, Vec2, Vec3, _decorator } from "cc";
|
import { BoxCollider2D, Collider2D, Component, Vec2, Vec3, _decorator } from "cc";
|
||||||
import { PlayerSettings } from "../../Data/GameSettings";
|
|
||||||
import { IInput } from "../../Input/IInput";
|
import { IInput } from "../../Input/IInput";
|
||||||
import { UnitHealth } from "../UnitHealth";
|
import { UnitHealth } from "../UnitHealth";
|
||||||
import { UnitLevel } from "../UnitLevel";
|
import { UnitLevel } from "../UnitLevel";
|
||||||
@ -11,7 +10,6 @@ const { ccclass, property } = _decorator;
|
|||||||
|
|
||||||
@ccclass("Player")
|
@ccclass("Player")
|
||||||
export class Player extends Component {
|
export class Player extends Component {
|
||||||
@property private speed = 0;
|
|
||||||
@property(BoxCollider2D) private collider: BoxCollider2D;
|
@property(BoxCollider2D) private collider: BoxCollider2D;
|
||||||
@property(PlayerUI) private playerUI: PlayerUI;
|
@property(PlayerUI) private playerUI: PlayerUI;
|
||||||
@property(Weapon) private weapon: Weapon;
|
@property(Weapon) private weapon: Weapon;
|
||||||
@ -20,18 +18,18 @@ export class Player extends Component {
|
|||||||
private health: UnitHealth;
|
private health: UnitHealth;
|
||||||
private level: UnitLevel;
|
private level: UnitLevel;
|
||||||
private regeneration: PlayerRegeneration;
|
private regeneration: PlayerRegeneration;
|
||||||
|
private speed: number;
|
||||||
|
|
||||||
public init(input: IInput, settings: PlayerData): void {
|
public init(input: IInput, data: PlayerData): void {
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.health = new UnitHealth(settings.defaultHP);
|
this.health = new UnitHealth(data.maxHp);
|
||||||
this.level = new UnitLevel(settings.requiredXP);
|
this.level = new UnitLevel(data.requiredXP, data.xpMultiplier);
|
||||||
this.regeneration = new PlayerRegeneration(this.health, settings.regenerationDelay);
|
this.regeneration = new PlayerRegeneration(this.health, data.regenerationDelay);
|
||||||
|
this.speed = data.speed;
|
||||||
|
|
||||||
this.weapon.init(settings.weapon);
|
this.weapon.init(data.strikeDelay, data.damage);
|
||||||
|
|
||||||
this.playerUI.init(this.health);
|
this.playerUI.init(this.health);
|
||||||
|
|
||||||
console.log("Bonus damage " + settings.bonusDamage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public get Health(): UnitHealth {
|
public get Health(): UnitHealth {
|
||||||
@ -70,10 +68,15 @@ export class Player extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PlayerData extends PlayerSettings {
|
export class PlayerData {
|
||||||
public bonusDamage = 0;
|
public requiredXP: number[] = [];
|
||||||
public bonusHp = 0;
|
public speed = 0;
|
||||||
public bonusSpeed = 0;
|
public maxHp = 0;
|
||||||
public bonusXP = 0;
|
public regenerationDelay = 0;
|
||||||
public bonusGold = 0;
|
public xpMultiplier = 0;
|
||||||
|
public goldMultiplier = 0;
|
||||||
|
|
||||||
|
// Weapon
|
||||||
|
public strikeDelay = 0;
|
||||||
|
public damage = 0;
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ export class Weapon extends Component {
|
|||||||
private strikeState: AnimationState;
|
private strikeState: AnimationState;
|
||||||
private damage: number;
|
private damage: number;
|
||||||
|
|
||||||
public init(settings: WeaponSettings): void {
|
public init(strikeDelay: number, damage: number): void {
|
||||||
this.strikeTimer = new GameTimer(settings.strikeDelay);
|
this.strikeTimer = new GameTimer(strikeDelay);
|
||||||
this.damage = settings.damage;
|
this.damage = damage;
|
||||||
this.node.active = false;
|
this.node.active = false;
|
||||||
|
|
||||||
this.weaponAnimation.on(Animation.EventType.FINISHED, this.endStrike, this);
|
this.weaponAnimation.on(Animation.EventType.FINISHED, this.endStrike, this);
|
||||||
|
@ -3,17 +3,15 @@ import { Signal } from "../../Services/EventSystem/Signal";
|
|||||||
|
|
||||||
export class UnitLevel {
|
export class UnitLevel {
|
||||||
private xp = 0;
|
private xp = 0;
|
||||||
private requiredXPs: number[];
|
|
||||||
private currentLevel = 0;
|
private currentLevel = 0;
|
||||||
private levelUpEvent: Signal<number> = new Signal<number>();
|
private levelUpEvent: Signal<number> = new Signal<number>();
|
||||||
private xpAddedEvent: Signal<number> = new Signal<number>();
|
private xpAddedEvent: Signal<number> = new Signal<number>();
|
||||||
|
|
||||||
public constructor(requiredXPs: number[]) {
|
public constructor(private requiredXPs: number[], private xpMultiplier: number) {}
|
||||||
this.requiredXPs = requiredXPs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public addXp(points: number): void {
|
public addXp(points: number): void {
|
||||||
this.xp += points;
|
this.xp += points * this.xpMultiplier;
|
||||||
this.xpAddedEvent.trigger(this.xp);
|
this.xpAddedEvent.trigger(this.xp);
|
||||||
this.tryLevelUp();
|
this.tryLevelUp();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user