complex-engine
Version:
JS Component Entity Framework for Gamedevelopment
2,909 lines (638 loc) • 27.8 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: World</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">Class: World</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>World<span class="signature">()</span><span class="type-signature"></span></h2>
<div class="class-description">The world contains all entities, systems and managers</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="World"><span class="type-signature"></span>new World<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line11">line 11</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="entities"><span class="type-signature"></span>entities<span class="type-signature"> :Array.<<a href="Entity.html">Entity</a>></span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Array.<<a href="Entity.html">Entity</a>></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line13">line 13</a>
</li></ul></dd>
</dl>
<h4 class="name" id="entitySystems"><span class="type-signature"></span>entitySystems<span class="type-signature"> :Array.<<a href="EntitySystem.html">EntitySystem</a>></span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Array.<<a href="EntitySystem.html">EntitySystem</a>></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
<h4 class="name" id="initialized"><span class="type-signature"></span>initialized<span class="type-signature"> :boolean</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">boolean</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
<h4 class="name" id="managers"><span class="type-signature"></span>managers<span class="type-signature"> :Array.<<a href="Manager.html">Manager</a>></span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Array.<<a href="Manager.html">Manager</a>></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line22">line 22</a>
</li></ul></dd>
</dl>
<h4 class="name" id="ticks"><span class="type-signature"></span>ticks<span class="type-signature"> :number</span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h4 class="name" id="voidSystems"><span class="type-signature"></span>voidSystems<span class="type-signature"> :Array.<<a href="VoidSystem.html">VoidSystem</a>></span></h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Array.<<a href="VoidSystem.html">VoidSystem</a>></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addEntity"><span class="type-signature"></span>addEntity<span class="signature">(entity)</span><span class="type-signature"> → {<a href="World.html">World</a>}</span></h4>
<div class="description">
Add entity to the world
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>entity</code></td>
<td class="type">
<span class="param-type"><a href="Entity.html">Entity</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line58">line 58</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="World.html">World</a></span>
</dd>
</dl>
<h4 class="name" id="addEntitySystem"><span class="type-signature"></span>addEntitySystem<span class="signature">(system)</span><span class="type-signature"></span></h4>
<div class="description">
Add new entity system to the world
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>system</code></td>
<td class="type">
<span class="param-type"><a href="EntitySystem.html">EntitySystem</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line131">line 131</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addManager"><span class="type-signature"></span>addManager<span class="signature">(manager)</span><span class="type-signature"> → {<a href="World.html">World</a>}</span></h4>
<div class="description">
Add Manager
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>manager</code></td>
<td class="type">
<span class="param-type"><a href="Manager.html">Manager</a></span>
</td>
<td class="description last">Manager instance</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line225">line 225</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="World.html">World</a></span>
</dd>
</dl>
<h4 class="name" id="addVoidSystem"><span class="type-signature"></span>addVoidSystem<span class="signature">(system)</span><span class="type-signature"></span></h4>
<div class="description">
Add new void system to the world
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>system</code></td>
<td class="type">
<span class="param-type"><a href="VoidSystem.html">VoidSystem</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line116">line 116</a>
</li></ul></dd>
</dl>
<h4 class="name" id="createEntity"><span class="type-signature"></span>createEntity<span class="signature">(components)</span><span class="type-signature"> → {<a href="Entity.html">Entity</a>}</span></h4>
<div class="description">
Creates and adds a new entity
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>components</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Component.html">Component</a>></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line36">line 36</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Entity.html">Entity</a></span>
</dd>
</dl>
<h4 class="name" id="getEntities"><span class="type-signature"></span>getEntities<span class="signature">()</span><span class="type-signature"> → {Array.<<a href="Entity.html">Entity</a>>}</span></h4>
<div class="description">
Get all entities from wold
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line108">line 108</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Entity.html">Entity</a>></span>
</dd>
</dl>
<h4 class="name" id="getEntitiesWithComponent"><span class="type-signature"></span>getEntitiesWithComponent<span class="signature">(component)</span><span class="type-signature"> → {Array.<<a href="Entity.html">Entity</a>>}</span></h4>
<div class="description">
Get a list of entities that match a component
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>component</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line311">line 311</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Entity.html">Entity</a>></span>
</dd>
</dl>
<h4 class="name" id="getEntitiesWithComponents"><span class="type-signature"></span>getEntitiesWithComponents<span class="signature">(components)</span><span class="type-signature"> → {Array.<<a href="Entity.html">Entity</a>>}</span></h4>
<div class="description">
Get a list of entities that match a component
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>components</code></td>
<td class="type">
<span class="param-type">Array.<function()></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line331">line 331</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Entity.html">Entity</a>></span>
</dd>
</dl>
<h4 class="name" id="getEntity"><span class="type-signature"></span>getEntity<span class="signature">(index)</span><span class="type-signature"> → {<a href="Entity.html">Entity</a>}</span></h4>
<div class="description">
Get entity from world by its id
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line97">line 97</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
Error
</div>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Entity.html">Entity</a></span>
</dd>
</dl>
<h4 class="name" id="getEntitySystems"><span class="type-signature"></span>getEntitySystems<span class="signature">()</span><span class="type-signature"> → {Array.<<a href="EntitySystem.html">EntitySystem</a>>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line429">line 429</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="EntitySystem.html">EntitySystem</a>></span>
</dd>
</dl>
<h4 class="name" id="getManager"><span class="type-signature"></span>getManager<span class="signature">(managerClass)</span><span class="type-signature"> → {<a href="Manager.html">Manager</a>}</span></h4>
<div class="description">
Get a manager
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>managerClass</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Manager class constructor</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line238">line 238</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
Error
</div>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Manager.html">Manager</a></span>
</dd>
</dl>
<h4 class="name" id="getManagers"><span class="type-signature"></span>getManagers<span class="signature">()</span><span class="type-signature"> → {Array.<<a href="Manager.html">Manager</a>>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line443">line 443</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="Manager.html">Manager</a>></span>
</dd>
</dl>
<h4 class="name" id="getSystem"><span class="type-signature"></span>getSystem<span class="signature">(systemClass)</span><span class="type-signature"> → {<a href="System.html">System</a>}</span></h4>
<div class="description">
get a System
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>systemClass</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Class constructor</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line168">line 168</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
Error
</div>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="System.html">System</a></span>
</dd>
</dl>
<h4 class="name" id="getVoidSystems"><span class="type-signature"></span>getVoidSystems<span class="signature">()</span><span class="type-signature"> → {Array.<<a href="VoidSystem.html">VoidSystem</a>>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line436">line 436</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.<<a href="VoidSystem.html">VoidSystem</a>></span>
</dd>
</dl>
<h4 class="name" id="init"><span class="type-signature"></span>init<span class="signature">()</span><span class="type-signature"> → {<a href="World.html">World</a>}</span></h4>
<div class="description">
After all systems has been added, this should be called to initiate them
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line146">line 146</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="World.html">World</a></span>
</dd>
</dl>
<h4 class="name" id="removeSystem"><span class="type-signature"></span>removeSystem<span class="signature">(systemClass)</span><span class="type-signature"> → {<a href="World.html">World</a>}</span></h4>
<div class="description">
Remove System
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>systemClass</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Class constructor</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line191">line 191</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="World.html">World</a></span>
</dd>
</dl>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Update the world
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="World.js.html">World.js</a>, <a href="World.js.html#line253">line 253</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
Error
</div>
</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>