Add player container
This commit is contained in:
parent
1cd8f5fbe6
commit
b55e927a34
4 changed files with 159 additions and 133 deletions
|
|
@ -8,7 +8,6 @@ import { CharacterTeam } from './character-team';
|
|||
export class CharacterBase extends GameObject {
|
||||
constructor(
|
||||
id: Id,
|
||||
public colorIndex: number,
|
||||
public team: CharacterTeam,
|
||||
public health: number,
|
||||
public head?: Circle,
|
||||
|
|
@ -19,7 +18,7 @@ export class CharacterBase extends GameObject {
|
|||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
const { id, colorIndex, team, health, head, leftFoot, rightFoot } = this;
|
||||
return [id, colorIndex, team, health, head, leftFoot, rightFoot];
|
||||
const { id, team, health, head, leftFoot, rightFoot } = this;
|
||||
return [id, team, health, head, leftFoot, rightFoot];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
export enum CharacterTeam {
|
||||
decla = 'decla',
|
||||
neutral = 'neutral',
|
||||
red = 'red',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ export class PlayerCharacterBase extends CharacterBase {
|
|||
public name: string,
|
||||
public killCount: number,
|
||||
public deathCount: number,
|
||||
colorIndex: number,
|
||||
team: CharacterTeam,
|
||||
health: number,
|
||||
head?: Circle,
|
||||
leftFoot?: Circle,
|
||||
rightFoot?: Circle,
|
||||
) {
|
||||
super(id, colorIndex, team, health, head, leftFoot, rightFoot);
|
||||
super(id, team, health, head, leftFoot, rightFoot);
|
||||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
|
|
@ -27,7 +26,6 @@ export class PlayerCharacterBase extends CharacterBase {
|
|||
this.name,
|
||||
this.killCount,
|
||||
this.deathCount,
|
||||
this.colorIndex,
|
||||
this.team,
|
||||
this.health,
|
||||
this.head,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { vec2 } from 'gl-matrix';
|
|||
import { Id } from '../../transport/identity';
|
||||
import { serializable } from '../../transport/serialization/serializable';
|
||||
import { GameObject } from '../game-object';
|
||||
import { CharacterTeam } from './character-team';
|
||||
|
||||
@serializable
|
||||
export class ProjectileBase extends GameObject {
|
||||
|
|
@ -9,13 +10,13 @@ export class ProjectileBase extends GameObject {
|
|||
id: Id,
|
||||
public center: vec2,
|
||||
public radius: number,
|
||||
public colorIndex: number,
|
||||
public team: CharacterTeam,
|
||||
public strength: number,
|
||||
) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.id, this.center, this.radius, this.colorIndex, this.strength];
|
||||
return [this.id, this.center, this.radius, this.team, this.strength];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue