gibbon.js
Version:
Actor/Component system for use with pixi.js.
32 lines (21 loc) • 536 B
text/typescript
import { Component } from '../core/component';
import type { Actor } from '../core/actor';
/**
* Not fully developed.
* Referencing actor on SharedComponent is not currently safe.
*/
export class SharedComponent extends Component {
private _attachCount: number = 0;
constructor() {
super();
throw Error("Not implemented.");
}
_init(actor: Actor) {
super._init(actor);
this._attachCount++;
}
destroy() {
this._attachCount--;
if (this._attachCount <= 0) super.destroy();
}
}