SpaceRace: Full-width TV field, death line scrolling, camera following leader, jump fix, path never fully blocked, player color on controller
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { Ship as ShipType, Position, Direction, posEqual } from '@spacerace/shared';
|
||||
|
||||
export class Ship {
|
||||
id: string;
|
||||
playerId: string;
|
||||
playerName: string;
|
||||
position: Position;
|
||||
direction: Direction;
|
||||
alive: boolean;
|
||||
shielded: boolean;
|
||||
phaseShifting: boolean;
|
||||
empActive: boolean;
|
||||
boostSteps: number;
|
||||
|
||||
constructor(id: string, playerId: string, playerName: string, position: Position, direction: Direction) {
|
||||
this.id = id;
|
||||
this.playerId = playerId;
|
||||
this.playerName = playerName;
|
||||
this.position = { ...position };
|
||||
this.direction = direction;
|
||||
this.alive = true;
|
||||
this.shielded = false;
|
||||
this.phaseShifting = false;
|
||||
this.empActive = false;
|
||||
this.boostSteps = 0;
|
||||
}
|
||||
|
||||
resetRoundEffects(): void {
|
||||
this.shielded = false;
|
||||
this.phaseShifting = false;
|
||||
this.empActive = false;
|
||||
this.boostSteps = 0;
|
||||
}
|
||||
|
||||
toState(): ShipType {
|
||||
return {
|
||||
id: this.id,
|
||||
playerId: this.playerId,
|
||||
playerName: this.playerName,
|
||||
position: { ...this.position },
|
||||
direction: this.direction,
|
||||
alive: this.alive,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user