UNPKG

gibbon.js

Version:

Actor/Component system for use with pixi.js.

30 lines 734 B
import { Component } from "../core/component"; export class TimeDestroy extends Component { /** * @property {number} timeMs - time in milliseconds before destroy/effect. * Setting to new value resets the timer. */ get timeMs() { return this._timer * 1000; } set timeMs(v) { this._timer = v / 1000; } get time() { return this._timer; } set time(v) { this._timer = v; } _timer = -1; update(delta) { if (this._timer >= 0) { this._timer -= delta; if (this._timer <= 0) { this._timer = -1; this.actor?.destroy(); } } } } //# sourceMappingURL=timeDestroy.js.map