Add server screen
This commit is contained in:
parent
89fafeafd3
commit
e2129bbb26
20 changed files with 672 additions and 174 deletions
3
shared/src/communication/player-information.ts
Normal file
3
shared/src/communication/player-information.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export interface PlayerInformation {
|
||||
name: string;
|
||||
}
|
||||
7
shared/src/communication/server-information.ts
Normal file
7
shared/src/communication/server-information.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export interface ServerInformation {
|
||||
playerLimit: number;
|
||||
playerCount: number;
|
||||
serverName: string;
|
||||
}
|
||||
|
||||
export const serverInformationEndpoint = '/stats';
|
||||
|
|
@ -25,6 +25,8 @@ export * from './helper/rectangle';
|
|||
export * from './helper/mix';
|
||||
export * from './helper/random';
|
||||
export * from './helper/id';
|
||||
export * from './communication/server-information';
|
||||
export * from './communication/player-information';
|
||||
export * from './helper/rotate-90-deg';
|
||||
export * from './helper/rotate-minus-90-deg';
|
||||
export * from './objects/game-object';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Random } from '../../helper/random';
|
||||
import { settings } from '../../settings';
|
||||
import { Id } from '../../transport/identity';
|
||||
import { serializable } from '../../transport/serialization/serializable';
|
||||
import { GameObject } from '../game-object';
|
||||
|
|
@ -9,6 +11,30 @@ export class PlanetBase extends GameObject {
|
|||
super(id);
|
||||
}
|
||||
|
||||
public static createPlanetVertices(
|
||||
center: vec2,
|
||||
width: number,
|
||||
height: number,
|
||||
randomness: number,
|
||||
vertexCount = settings.polygonEdgeCount,
|
||||
): Array<vec2> {
|
||||
const vertices = [];
|
||||
|
||||
for (let i = 0; i < vertexCount; i++) {
|
||||
vertices.push(
|
||||
vec2.fromValues(
|
||||
center.x +
|
||||
(width / 2) * Math.cos((i / vertexCount) * -Math.PI * 2) +
|
||||
Random.getRandomInRange(-randomness, randomness),
|
||||
center.y +
|
||||
(height / 2) * Math.sin((i / vertexCount) * -Math.PI * 2) +
|
||||
Random.getRandomInRange(-randomness, randomness),
|
||||
),
|
||||
);
|
||||
}
|
||||
return vertices;
|
||||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.id, this.vertices];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,6 @@
|
|||
"module": "commonjs",
|
||||
"composite": true,
|
||||
"lib": ["dom", "es2017"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue