]> git.r.bdr.sh - rbdr/serpentity/blob - lib/serpentity/system.js
339f6e7769479aa87550ae42bbc361e2006f3d2a
[rbdr/serpentity] / lib / serpentity / system.js
1 'use strict';
2
3 /* global Serpentity */
4
5 /*
6 * Systems contain most of the logic, and work with nodes in order to
7 * act and change their values.
8 *
9 * You usually want to inherit from this class and override the
10 * three methods. They are shown here to document the interface.
11 */
12
13 let System = class System {
14
15 /*
16 * This will be run when the system is added to the engine
17 */
18 added () {
19 // Override with added(engine)
20 // Receives an instance of the serpentity engine
21 }
22
23 /*
24 * This will be run when the system is removed from the engine
25 */
26 removed () {
27 // Override with removed(engine)
28 // Receives an instance of the serpentity engine
29 }
30
31 /*
32 * This will run every time the engine's update method is called
33 */
34 update () {
35 // Override with update(dt)
36 // Receives a delta of the time
37 }
38 };
39
40 if (typeof module !== 'undefined' && this.module !== module) {
41 module.exports = System;
42 } else {
43 Serpentity.System = System;
44 }