UNPKG

complex-engine

Version:

JS Component Entity Framework for Gamedevelopment

101 lines (74 loc) 2.58 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: System/EntitySystem.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: System/EntitySystem.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>'use strict'; import System from '../System'; import Entity from '../Entity'; import World from '../World'; /** * This systems renders only entities that match the required components. * @abstract */ class EntitySystem extends System { /** * Define required components * @param {Function[]} components */ constructor(components = []) { super(); /** @var {Function[]} */ this.components = components; } /** * Process all entities matching the required components * @param {Entity[]} entities */ processEntities(entities) { for (let i = 0; i &lt; entities.length; i++) { this.update(entities[i]); } } /** * Get list of components to work with this system * @returns {Function[]} */ getComponents() { return this.components; } /** * @param {Entity} entity */ update(entity) { }; } export default EntitySystem; </code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Component.html">Component</a></li><li><a href="Engine.html">Engine</a></li><li><a href="Entity.html">Entity</a></li><li><a href="EntitySystem.html">EntitySystem</a></li><li><a href="GroupManager.html">GroupManager</a></li><li><a href="Manager.html">Manager</a></li><li><a href="Scene.html">Scene</a></li><li><a href="System.html">System</a></li><li><a href="VoidSystem.html">VoidSystem</a></li><li><a href="World.html">World</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Sep 08 2019 20:40:30 GMT+0200 (Central European Summer Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>