Fix some issues
This commit is contained in:
parent
c0a588fb73
commit
1ce961d6c2
27 changed files with 432 additions and 200 deletions
|
|
@ -1,17 +1,19 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { CharacterTeam } from '../../objects/types/character-team';
|
||||
import { Id } from '../../transport/identity';
|
||||
import { serializable } from '../../transport/serialization/serializable';
|
||||
import { Command } from '../command';
|
||||
|
||||
@serializable
|
||||
export class OtherPlayerDirection {
|
||||
public constructor(
|
||||
public readonly id: Id,
|
||||
public readonly direction: vec2,
|
||||
public readonly team: CharacterTeam,
|
||||
) {}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.direction, this.team];
|
||||
return [this.id, this.direction, this.team];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { Command } from '../commands/command';
|
||||
import { Id } from '../transport/identity';
|
||||
import { serializable } from '../transport/serialization/serializable';
|
||||
|
||||
|
|
@ -10,6 +11,39 @@ export class RemoteCall {
|
|||
}
|
||||
}
|
||||
|
||||
@serializable
|
||||
export class UpdateProperty {
|
||||
constructor(
|
||||
public readonly propertyKey: string,
|
||||
public readonly propertyValue: any,
|
||||
public readonly rateOfChange: any,
|
||||
) {}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.propertyKey, this.propertyValue, this.rateOfChange];
|
||||
}
|
||||
}
|
||||
|
||||
@serializable
|
||||
export class PropertyUpdatesForObject {
|
||||
constructor(public readonly id: Id, public readonly updates: Array<UpdateProperty>) {}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.id, this.updates];
|
||||
}
|
||||
}
|
||||
|
||||
@serializable
|
||||
export class PropertyUpdatesForObjects extends Command {
|
||||
constructor(public readonly updates: Array<PropertyUpdatesForObject>) {
|
||||
super();
|
||||
}
|
||||
|
||||
public toArray(): Array<any> {
|
||||
return [this.updates];
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class GameObject {
|
||||
private remoteCalls: Array<RemoteCall> = [];
|
||||
|
||||
|
|
@ -23,6 +57,8 @@ export abstract class GameObject {
|
|||
);
|
||||
}
|
||||
|
||||
public getPropertyUpdates(): PropertyUpdatesForObject | void {}
|
||||
|
||||
public getRemoteCalls(): Array<RemoteCall> {
|
||||
return this.remoteCalls;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,15 +22,6 @@ export class PlayerCharacterBase extends GameObject {
|
|||
|
||||
public onShoot(strength: number) {}
|
||||
|
||||
public updateCircles(head: Circle, leftFoot: Circle, rightFoot: Circle) {
|
||||
this.head!.center = head.center;
|
||||
this.head!.radius = head.radius;
|
||||
this.leftFoot!.center = leftFoot.center;
|
||||
this.leftFoot!.radius = leftFoot.radius;
|
||||
this.rightFoot!.center = rightFoot.center;
|
||||
this.rightFoot!.radius = rightFoot.radius;
|
||||
}
|
||||
|
||||
public setHealth(health: number) {
|
||||
this.health = health;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@ export class ProjectileBase extends GameObject {
|
|||
super(id);
|
||||
}
|
||||
|
||||
public setCenter(center: vec2) {
|
||||
this.center = center;
|
||||
}
|
||||
|
||||
public step(deltaTimeInSeconds: number) {
|
||||
this.strength -= settings.projectileFadeSpeed * deltaTimeInSeconds;
|
||||
this.strength = Math.max(0, this.strength);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export const settings = {
|
|||
playerDiedTimeout: 5,
|
||||
playerStrengthRegenerationPerSeconds: 80,
|
||||
projectileMaxStrength: 40,
|
||||
projectileSpeed: 4000,
|
||||
projectileSpeed: 2500,
|
||||
projectileMaxBounceCount: 2,
|
||||
projectileTimeout: 3,
|
||||
projectileFadeSpeed: 20,
|
||||
|
|
@ -111,7 +111,6 @@ export const settings = {
|
|||
},
|
||||
palette: [declaColor, neutralColor, redColor],
|
||||
paletteDim: [declaColorDim, neutralColor, redColorDim],
|
||||
targetPhysicsDeltaTimeInMilliseconds: 15,
|
||||
minPhysicsSleepTime: 4,
|
||||
targetPhysicsDeltaTimeInSeconds: 1 / 100,
|
||||
inViewAreaSize: 1920 * 1080 * 3,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue