Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
{
"uid": "613817565CED434E2F3AF0808662C3BAEF91",
"isLoaded": true,
"lastModificationTime": 0,
"items": {
"name": "Component_IntervalTimer",
"type": "game_script",
"order": 21,
"content": "# ===================================================================\n#\n# Script: Component_IntervalTimer\n#\n# $$COPYRIGHT$$\n#\n# ===================================================================\nclass Component_IntervalTimer extends gs.Component\n ###*\n * A component which adds timing-features to a game object. The game object\n * will send an \"elapsed\" event everytime the time interval has been elapsed.\n *\n * @module gs\n * @class Component_IntervalTimer\n * @extends gs.Component\n * @memberof gs\n ###\n constructor: ->\n super()\n \n ###*\n * Indicates if the timer is running. \n *\n * @property isRunning\n * @type boolean\n * @readOnly\n ###\n @isRunning = no\n \n ###*\n * @property frameCount\n * @type number\n * @private\n ###\n @frameCount = 0\n \n ###*\n * The interval at which the associated action will be executed.\n * @property interval\n * @type number\n ###\n @interval = 0\n \n ###*\n * Starts the timer. \n *\n * @method start\n ###\n start: -> \n @isRunning = yes\n @frameCount = 0\n \n ###*\n * Stops the timer. \n *\n * @method stop\n ### \n stop: -> @isRunning = no\n \n ###*\n * Resumes the timer. \n *\n * @method resume\n ###\n resume: -> @isRunning = yes\n \n ###*\n * Pauses the timer. \n *\n * @method pause\n ###\n pause: -> @isRunning = no\n \n ###*\n * Updates the timer.\n *\n * @method update\n ###\n update: ->\n if @isRunning\n @frameCount++\n \n if @frameCount >= @interval\n @object.events.emit(\"elapsed\", @object)\n @frameCount = 0\n \n \n \n\n \n \ngs.Component_IntervalTimer = Component_IntervalTimer",
"parentId": "D3325122KACDEA4515SB731E37A42B9D779F",
"folder": false,
"scriptType": 0,
"compiledContent": "var Component_IntervalTimer,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\n hasProp = {}.hasOwnProperty;\n\nComponent_IntervalTimer = (function(superClass) {\n extend(Component_IntervalTimer, superClass);\n\n\n /**\n * A component which adds timing-features to a game object. The game object\n * will send an \"elapsed\" event everytime the time interval has been elapsed.\n *\n * @module gs\n * @class Component_IntervalTimer\n * @extends gs.Component\n * @memberof gs\n */\n\n function Component_IntervalTimer() {\n Component_IntervalTimer.__super__.constructor.call(this);\n\n /**\n * Indicates if the timer is running. \n *\n * @property isRunning\n * @type boolean\n * @readOnly\n */\n this.isRunning = false;\n\n /**\n * @property frameCount\n * @type number\n * @private\n */\n this.frameCount = 0;\n\n /**\n * The interval at which the associated action will be executed.\n * @property interval\n * @type number\n */\n this.interval = 0;\n }\n\n\n /**\n * Starts the timer. \n *\n * @method start\n */\n\n Component_IntervalTimer.prototype.start = function() {\n this.isRunning = true;\n return this.frameCount = 0;\n };\n\n\n /**\n * Stops the timer. \n *\n * @method stop\n */\n\n Component_IntervalTimer.prototype.stop = function() {\n return this.isRunning = false;\n };\n\n\n /**\n * Resumes the timer. \n *\n * @method resume\n */\n\n Component_IntervalTimer.prototype.resume = function() {\n return this.isRunning = true;\n };\n\n\n /**\n * Pauses the timer. \n *\n * @method pause\n */\n\n Component_IntervalTimer.prototype.pause = function() {\n return this.isRunning = false;\n };\n\n\n /**\n * Updates the timer.\n *\n * @method update\n */\n\n Component_IntervalTimer.prototype.update = function() {\n if (this.isRunning) {\n this.frameCount++;\n if (this.frameCount >= this.interval) {\n this.object.events.emit(\"elapsed\", this.object);\n return this.frameCount = 0;\n }\n }\n };\n\n return Component_IntervalTimer;\n\n})(gs.Component);\n\ngs.Component_IntervalTimer = Component_IntervalTimer;\n\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLElBQUEsdUJBQUE7RUFBQTs7O0FBQU07Ozs7QUFDRjs7Ozs7Ozs7OztFQVNhLGlDQUF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Y3JpcHQ6IENvbXBvbmVudF9JbnRlcnZhbFRpbWVyXG4jXG4jICAgJCRDT1BZUklHSFQkJFxuI1xuIyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG5jbGFzcyBDb21wb25lbnRfSW50ZXJ2YWxUaW1lciBleHRlbmRzIGdzLkNvbXBvbmVudFxuICAgICMjIypcbiAgICAqIEEgY29tcG9uZW50IHdoaWNoIGFkZHMgdGltaW5nLWZlYXR1cmVzIHRvIGEgZ2FtZSBvYmplY3QuIFRoZSBnYW1lIG9iamVjdFxuICAgICogd2lsbCBzZW5kIGFuIFwiZWxhcHNlZFwiIGV2ZW50IGV2ZXJ5dGltZSB0aGUgdGltZSBpbnRlcnZhbCBoYXMgYmVlbiBlbGFwc2VkLlxuICAgICpcbiAgICAqIEBtb2R1bGUgZ3NcbiAgICAqIEBjbGFzcyBDb21wb25lbnRfSW50ZXJ2YWxUaW1lclxuICAgICogQGV4dGVuZHMgZ3MuQ29tcG9uZW50XG4gICAgKiBAbWVtYmVyb2YgZ3NcbiAgICAjIyNcbiAgICBjb25zdHJ1Y3RvcjogLT5cbiAgICAgICAgc3VwZXIoKVxuICAgICAgICBcbiAgICAgICAgIyMjKlxuICAgICAgICAqIEluZGljYXRlcyBpZiB0aGUgdGltZXIgaXMgcnVubmluZy4gXG4gICAgICAgICpcbiAgICAgICAgKiBAcHJvcGVydHkgaXNSdW5uaW5nXG4gICAgICAgICogQHR5cGUgYm9vbGVhblxuICAgICAgICAqIEByZWFkT25seVxuICAgICAgICAjIyNcbiAgICAgICAgQGlzUnVubmluZyA9IG5vXG4gICAgICAgIFxuICAgICAgICAjIyMqXG4gICAgICAgICogQHByb3BlcnR5IGZyYW1lQ291bnRcbiAgICAgICAgKiBAdHlwZSBudW1iZXJcbiAgICAgICAgKiBAcHJpdmF0ZVxuICAgICAgICAjIyNcbiAgICAgICAgQGZyYW1lQ291bnQgPSAwXG4gICAgICAgIFxuICAgICAgICAjIyMqXG4gICAgICAgICogVGhlIGludGVydmFsIGF0IHdoaWNoIHRoZSBhc3NvY2lhdGVkIGFjdGlvbiB3aWxsIGJlIGV4ZWN1dGVkLlxuICAgICAgICAqIEBwcm9wZXJ0eSBpbnRlcnZhbFxuICAgICAgICAqIEB0eXBlIG51bWJlclxuICAgICAgICAjIyNcbiAgICAgICAgQGludGVydmFsID0gMFxuICAgICAgICBcbiAgICAjIyMqXG4gICAgKiBTdGFydHMgdGhlIHRpbWVyLiBcbiAgICAqXG4gICAgKiBAbWV0aG9kIHN0YXJ0XG4gICAgIyMjXG4gICAgc3RhcnQ6IC0+IFxuICAgICAgICBAaXNSdW5uaW5nID0geWVzXG4gICAgICAgIEBmcmFtZUNvdW50ID0gMFxuICAgICBcbiAgICAjIyMqXG4gICAgKiBTdG9wcyB0aGUgdGltZXIuIFxuICAgICpcbiAgICAqIEBtZXRob2Qgc3RvcFxuICAgICMjIyAgIFxuICAgIHN0b3A6IC0+IEBpc1J1bm5pbmcgPSBub1xuICAgIFxuICAgICMjIypcbiAgICAqIFJlc3VtZXMgdGhlIHRpbWVyLiBcbiAgICAqXG4gICAgKiBAbWV0aG9kIHJlc3VtZVxuICAgICMjI1xuICAgIHJlc3VtZTogLT4gQGlzUnVubmluZyA9IHllc1xuICAgIFxuICAgICMjIypcbiAgICAqIFBhdXNlcyB0aGUgdGltZXIuIFxuICAgICpcbiAgICAqIEBtZXRob2QgcGF1c2VcbiAgICAjIyNcbiAgICBwYXVzZTogLT4gQGlzUnVubmluZyA9IG5vXG4gICAgICAgIFxuICAgICMjIypcbiAgICAqIFVwZGF0ZXMgdGhlIHRpbWVyLlxuICAgICpcbiAgICAqIEBtZXRob2QgdXBkYXRlXG4gICAgIyMjXG4gICAgdXBkYXRlOiAtPlxuICAgICAgICBpZiBAaXNSdW5uaW5nXG4gICAgICAgICAgICBAZnJhbWVDb3VudCsrXG4gICAgICAgICAgICBcbiAgICAgICAgICAgIGlmIEBmcmFtZUNvdW50ID49IEBpbnRlcnZhbFxuICAgICAgICAgICAgICAgIEBvYmplY3QuZXZlbnRzLmVtaXQoXCJlbGFwc2VkXCIsIEBvYmplY3QpXG4gICAgICAgICAgICAgICAgQGZyYW1lQ291bnQgPSAwXG4gICAgICAgICAgICBcbiAgICAgICAgXG4gICAgICAgICAgICBcblxuICAgICAgICBcbiBcbmdzLkNvbXBvbmVudF9JbnRlcnZhbFRpbWVyID0gQ29tcG9uZW50X0ludGVydmFsVGltZXIiXX0=\n//# sourceURL=Component_IntervalTimer_174.js"
},
"summary": [
"name",
"type",
"order"
]
}
|
Revision |
Author |
Commited |
Message |
1084
|
MOliva
|
Fri 11 May, 2018 12:41:55 +0000 |
|