Refactor
This commit is contained in:
parent
1ce961d6c2
commit
99cdb62928
76 changed files with 340 additions and 433 deletions
|
|
@ -9,7 +9,7 @@ import { DynamicPhysical } from '../physics/physicals/dynamic-physical';
|
|||
import {
|
||||
ReactsToCollision,
|
||||
reactsToCollision,
|
||||
} from '../physics/physicals/reacts-to-collision';
|
||||
} from '../physics/functions/reacts-to-collision';
|
||||
|
||||
@serializesTo(Circle)
|
||||
export class CirclePhysical implements Circle, DynamicPhysical, ReactsToCollision {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { interpolateAngles } from '../helper/interpolate-angles';
|
|||
import { forceAtPosition } from '../physics/functions/force-at-position';
|
||||
import { getBoundingBoxOfCircle } from '../physics/functions/get-bounding-box-of-circle';
|
||||
import { PlanetPhysical } from './planet-physical';
|
||||
import { ReactsToCollision } from '../physics/physicals/reacts-to-collision';
|
||||
import { ReactsToCollision } from '../physics/functions/reacts-to-collision';
|
||||
|
||||
@serializesTo(PlayerCharacterBase)
|
||||
export class PlayerCharacterPhysical
|
||||
|
|
@ -479,6 +479,7 @@ export class PlayerCharacterPhysical
|
|||
|
||||
public kill() {
|
||||
this.isDestroyed = true;
|
||||
this.remoteCall('kill');
|
||||
}
|
||||
|
||||
private destroy() {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { CirclePhysical } from './circle-physical';
|
|||
import { DynamicPhysical } from '../physics/physicals/dynamic-physical';
|
||||
import { PhysicalContainer } from '../physics/containers/physical-container';
|
||||
import { PlanetPhysical } from './planet-physical';
|
||||
import { ReactsToCollision } from '../physics/physicals/reacts-to-collision';
|
||||
import { ReactsToCollision } from '../physics/functions/reacts-to-collision';
|
||||
import { PlayerCharacterPhysical } from './player-character-physical';
|
||||
import { moveCircle } from '../physics/functions/move-circle';
|
||||
|
||||
|
|
@ -114,24 +114,6 @@ export class ProjectilePhysical
|
|||
return;
|
||||
}
|
||||
|
||||
const gravity = vec2.create();
|
||||
const intersecting = this.container.findIntersecting(this.boundingBox);
|
||||
intersecting.forEach((i) => {
|
||||
if (i instanceof PlanetPhysical) {
|
||||
vec2.add(gravity, gravity, i.getForce(this.center));
|
||||
}
|
||||
});
|
||||
|
||||
vec2.add(
|
||||
this.velocity,
|
||||
this.velocity,
|
||||
vec2.scale(
|
||||
vec2.create(),
|
||||
gravity,
|
||||
deltaTime * settings.gravityScalingForProjectiles,
|
||||
),
|
||||
);
|
||||
|
||||
vec2.copy(this.object.velocity, this.velocity);
|
||||
const { velocity } = this.object.step2(deltaTime);
|
||||
vec2.copy(this.velocity, velocity);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue