@awayjs/scene
Version:
AwayJS scene classes
43 lines (42 loc) • 1.31 kB
JavaScript
import { __extends } from "tslib";
import { AssetBase, AbstractMethodError } from '@awayjs/core';
/**
* PrefabBase is an abstract base class for prefabs,
* which are prebuilt display objects that allow easy cloning and updating
*/
var PrefabBase = /** @class */ (function (_super) {
__extends(PrefabBase, _super);
// public _pBatchObjects:Array<BatchObject> = new Array<BatchObject>();
/**
* Creates a new PrefabBase object.
*/
function PrefabBase() {
var _this = _super.call(this) || this;
_this._pObjects = new Array();
return _this;
}
/**
* Returns a display object generated from this prefab
*/
PrefabBase.prototype.getNewObject = function () {
var object = this._pCreateObject();
this._pObjects.push(object);
return object;
};
// public getNewBatchObject():BatchObject
// {
// var object:BatchObject = this._pCreateBatchObject();
//
// this._pBatchObjects.push(object);
//
// return object;
// }
PrefabBase.prototype._pCreateObject = function () {
throw new AbstractMethodError();
};
PrefabBase.prototype._iValidate = function () {
// To be overridden when necessary
};
return PrefabBase;
}(AssetBase));
export { PrefabBase };