the-world-engine
Version:
three.js based, unity like game engine for browser
36 lines (35 loc) • 745 B
JavaScript
import { EventContainer } from "../../collection/EventContainer";
export class PhysicsMaterial2D {
zi=new EventContainer;
Gi;
Ji;
constructor(t = .4, i = 0) {
this.Gi = t;
this.Ji = i;
}
get friction() {
return this.Gi;
}
set friction(t) {
this.Gi = t;
this.zi.invoke();
}
get bounciness() {
return this.Ji;
}
set bounciness(t) {
this.Ji = t;
this.zi.invoke();
}
get onChanged() {
return this.zi;
}
copy(t) {
this.friction = t.friction;
this.bounciness = t.bounciness;
this.zi.invoke();
}
clone() {
return new PhysicsMaterial2D(this.friction, this.bounciness);
}
}