Add npcs
This commit is contained in:
parent
a66fa63b4b
commit
efa838a2ad
2 changed files with 1688 additions and 365 deletions
|
|
@ -1,26 +0,0 @@
|
|||
import { Circle } from '../../helper/circle';
|
||||
import { Id } from '../../transport/identity';
|
||||
import { serializable } from '../../transport/serialization/serializable';
|
||||
import { GameObject } from '../game-object';
|
||||
import { CharacterTeam } from './character-team';
|
||||
|
||||
@serializable
|
||||
export class CharacterBase extends GameObject {
|
||||
constructor(
|
||||
id: Id,
|
||||
public team: CharacterTeam,
|
||||
public health: number,
|
||||
public head?: Circle,
|
||||
public leftFoot?: Circle,
|
||||
public rightFoot?: Circle,
|
||||
) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public onShoot(strength: number) {}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
const { id, team, health, head, leftFoot, rightFoot } = this;
|
||||
return [id, team, health, head, leftFoot, rightFoot];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,23 @@
|
|||
import { CharacterBase } from './character-base';
|
||||
import { Circle } from '../../helper/circle';
|
||||
import { Id } from '../../transport/identity';
|
||||
import { serializable } from '../../transport/serialization/serializable';
|
||||
import { GameObject } from '../game-object';
|
||||
import { CharacterTeam } from './character-team';
|
||||
|
||||
@serializable
|
||||
export class PlayerCharacterBase extends CharacterBase {
|
||||
export class PlayerCharacterBase extends GameObject {
|
||||
constructor(
|
||||
id: Id,
|
||||
public name: string,
|
||||
public killCount: number,
|
||||
public deathCount: number,
|
||||
team: CharacterTeam,
|
||||
health: number,
|
||||
head?: Circle,
|
||||
leftFoot?: Circle,
|
||||
rightFoot?: Circle,
|
||||
public team: CharacterTeam,
|
||||
public health: number,
|
||||
public head?: Circle,
|
||||
public leftFoot?: Circle,
|
||||
public rightFoot?: Circle,
|
||||
) {
|
||||
super(id, team, health, head, leftFoot, rightFoot);
|
||||
super(id);
|
||||
}
|
||||
|
||||
public onShoot(strength: number) {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue