Refactor
This commit is contained in:
parent
b774357807
commit
57d7009342
39 changed files with 203 additions and 250 deletions
|
|
@ -1,10 +1,10 @@
|
|||
import { PlayerCharacterBase } from '../../objects/types/player-character-base';
|
||||
import { CharacterBase } from '../../objects/types/character-base';
|
||||
import { serializable } from '../../serialization/serializable';
|
||||
import { Command } from '../command';
|
||||
|
||||
@serializable
|
||||
export class CreatePlayerCommand extends Command {
|
||||
public constructor(public readonly character: PlayerCharacterBase) {
|
||||
public constructor(public readonly character: CharacterBase) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { CharacterTeam } from '../../objects/types/character-team';
|
||||
import { CharacterTeam } from '../../objects/types/character-base';
|
||||
import { serializable } from '../../serialization/serializable';
|
||||
import { Command } from '../command';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Id } from '../../communication/id';
|
||||
import { CharacterTeam } from '../../objects/types/character-team';
|
||||
import { CharacterTeam } from '../../objects/types/character-base';
|
||||
import { serializable } from '../../serialization/serializable';
|
||||
import { Command } from '../command';
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@ export class Circle {
|
|||
return vec2.distance(this.center, target) - this.radius;
|
||||
}
|
||||
|
||||
public distanceBetween(target: Circle): number {
|
||||
return vec2.distance(target.center, this.center) - this.radius - target.radius;
|
||||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.center, this.radius];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ export * from './serialization/serialize';
|
|||
export * from './serialization/serializes-to';
|
||||
export * from './serialization/serializable';
|
||||
export * from './serialization/override-deserialization';
|
||||
export * from './objects/types/character-team';
|
||||
export * from './objects/types/player-character-base';
|
||||
export * from './objects/types/character-base';
|
||||
export * from './objects/types/lamp-base';
|
||||
export * from './objects/types/planet-base';
|
||||
export * from './objects/types/projectile-base';
|
||||
|
|
|
|||
|
|
@ -2,10 +2,15 @@ import { Id } from '../../communication/id';
|
|||
import { Circle } from '../../helper/circle';
|
||||
import { serializable } from '../../serialization/serializable';
|
||||
import { GameObject } from '../game-object';
|
||||
import { CharacterTeam } from './character-team';
|
||||
|
||||
export enum CharacterTeam {
|
||||
decla = 'decla',
|
||||
neutral = 'neutral',
|
||||
red = 'red',
|
||||
}
|
||||
|
||||
@serializable
|
||||
export class PlayerCharacterBase extends GameObject {
|
||||
export class CharacterBase extends GameObject {
|
||||
constructor(
|
||||
id: Id,
|
||||
public name: string,
|
||||
|
|
@ -26,7 +31,7 @@ export class PlayerCharacterBase extends GameObject {
|
|||
this.health = health;
|
||||
}
|
||||
|
||||
public kill() {}
|
||||
public onDie() {}
|
||||
|
||||
public setKillCount(killCount: number) {
|
||||
this.killCount = killCount;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
export enum CharacterTeam {
|
||||
decla = 'decla',
|
||||
neutral = 'neutral',
|
||||
red = 'red',
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@ import { vec2 } from 'gl-matrix';
|
|||
import { settings } from '../../settings';
|
||||
import { serializable } from '../../serialization/serializable';
|
||||
import { GameObject } from '../game-object';
|
||||
import { CharacterTeam } from './character-team';
|
||||
import { Id } from '../../communication/id';
|
||||
import { CharacterTeam } from './character-base';
|
||||
|
||||
@serializable
|
||||
export class ProjectileBase extends GameObject {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { rgb255 } from './helper/rgb255';
|
||||
import { CharacterTeam } from './objects/types/character-team';
|
||||
import { CharacterTeam } from './objects/types/character-base';
|
||||
|
||||
const declaColor = rgb255(64, 105, 165);
|
||||
const neutralColor = rgb255(82, 165, 64);
|
||||
|
|
@ -19,6 +19,7 @@ export const settings = {
|
|||
worldRadius: 10000,
|
||||
objectsOnCircleLength: 0.002,
|
||||
planetEdgeCount: 7,
|
||||
playerKillPoint: 10,
|
||||
takeControlTimeInSeconds: 4,
|
||||
loseControlTimeInSeconds: 24,
|
||||
planetPointGenerationInterval: 1.5,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue