felflame 1.0.2 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/.ruby-version +1 -0
- data/CHANGELOG.mdown +56 -1
- data/Gemfile +2 -3
- data/Gemfile.lock +4 -4
- data/README.mdown +127 -74
- data/Rakefile +30 -10
- data/bin/console +3 -3
- data/docs/FelFlame/ComponentManager.html +131 -519
- data/docs/FelFlame/Components.html +29 -119
- data/docs/FelFlame/Entities.html +125 -387
- data/docs/FelFlame/Order.html +251 -0
- data/docs/FelFlame/Scenes.html +72 -68
- data/docs/FelFlame/Stage.html +30 -56
- data/docs/FelFlame/Systems.html +208 -244
- data/docs/FelFlame.html +34 -32
- data/docs/Felflame_.html +143 -0
- data/docs/_index.html +24 -4
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +145 -83
- data/docs/file.version.html +74 -0
- data/docs/index.html +145 -83
- data/docs/method_list.html +52 -108
- data/docs/top-level-namespace.html +5 -5
- data/felflame.gemspec +21 -21
- data/lib/felflame/component_manager.rb +99 -71
- data/lib/felflame/entity_manager.rb +84 -59
- data/lib/felflame/order.rb +24 -0
- data/lib/felflame/scene_manager.rb +23 -12
- data/lib/felflame/stage_manager.rb +10 -33
- data/lib/felflame/system_manager.rb +92 -47
- data/lib/felflame/version.rb +5 -1
- data/lib/felflame.rb +26 -15
- metadata +35 -31
- data/.yardopts +0 -13
data/docs/FelFlame/Entities.html
CHANGED
@@ -37,7 +37,7 @@
|
|
37
37
|
<div id="menu">
|
38
38
|
|
39
39
|
<a href="../_index.html">Index (E)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (
|
40
|
+
<span class='title'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span>
|
41
41
|
»
|
42
42
|
<span class="title">Entities</span>
|
43
43
|
|
@@ -85,11 +85,6 @@
|
|
85
85
|
|
86
86
|
|
87
87
|
|
88
|
-
<dl>
|
89
|
-
<dt>Extended by:</dt>
|
90
|
-
<dd>Enumerable</dd>
|
91
|
-
</dl>
|
92
|
-
|
93
88
|
|
94
89
|
|
95
90
|
|
@@ -99,8 +94,8 @@
|
|
99
94
|
|
100
95
|
<dl>
|
101
96
|
<dt>Defined in:</dt>
|
102
|
-
<dd>felflame.rb<span class="defines">,<br />
|
103
|
-
entity_manager.rb</span>
|
97
|
+
<dd>lib/felflame.rb<span class="defines">,<br />
|
98
|
+
lib/felflame/entity_manager.rb</span>
|
104
99
|
</dd>
|
105
100
|
</dl>
|
106
101
|
|
@@ -109,7 +104,7 @@
|
|
109
104
|
<h2>Overview</h2><div class="docstring">
|
110
105
|
<div class="discussion">
|
111
106
|
|
112
|
-
<p>Creates and manages Entities.
|
107
|
+
<p>Creates and manages Entities. Entities are just collections of Components. You can use array methods directly on this class to access Entities.</p>
|
113
108
|
|
114
109
|
|
115
110
|
</div>
|
@@ -121,46 +116,12 @@
|
|
121
116
|
|
122
117
|
|
123
118
|
|
124
|
-
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
125
|
-
<ul class="summary">
|
126
|
-
|
127
|
-
<li class="public ">
|
128
|
-
<span class="summary_signature">
|
129
|
-
|
130
|
-
<a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> ⇒ Integer </a>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
</span>
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<span class="note title readonly">readonly</span>
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
<span class="summary_desc"><div class='inline'>
|
150
|
-
<p>Holds the unique ID of this entity.</p>
|
151
|
-
</div></span>
|
152
|
-
|
153
|
-
</li>
|
154
|
-
|
155
|
-
|
156
|
-
</ul>
|
157
|
-
|
158
119
|
|
159
120
|
|
160
121
|
|
161
122
|
|
162
123
|
<h2>
|
163
|
-
|
124
|
+
Instance Method Summary
|
164
125
|
<small><a href="#" class="summary_toggle">collapse</a></small>
|
165
126
|
</h2>
|
166
127
|
|
@@ -169,31 +130,7 @@
|
|
169
130
|
<li class="public ">
|
170
131
|
<span class="summary_signature">
|
171
132
|
|
172
|
-
<a href="#
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
</span>
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
<span class="summary_desc"><div class='inline'>
|
187
|
-
<p>Gets an Entity from the given <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">unique ID</a></span>.</p>
|
188
|
-
</div></span>
|
189
|
-
|
190
|
-
</li>
|
191
|
-
|
192
|
-
|
193
|
-
<li class="public ">
|
194
|
-
<span class="summary_signature">
|
195
|
-
|
196
|
-
<a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&block) ⇒ Enumerator </a>
|
133
|
+
<a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(*components_to_add) ⇒ Boolean </a>
|
197
134
|
|
198
135
|
|
199
136
|
|
@@ -208,25 +145,16 @@
|
|
208
145
|
|
209
146
|
|
210
147
|
<span class="summary_desc"><div class='inline'>
|
211
|
-
<p>
|
148
|
+
<p>Add any number components to the Entity.</p>
|
212
149
|
</div></span>
|
213
150
|
|
214
151
|
</li>
|
215
152
|
|
216
153
|
|
217
|
-
</ul>
|
218
|
-
|
219
|
-
<h2>
|
220
|
-
Instance Method Summary
|
221
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
222
|
-
</h2>
|
223
|
-
|
224
|
-
<ul class="summary">
|
225
|
-
|
226
154
|
<li class="public ">
|
227
155
|
<span class="summary_signature">
|
228
156
|
|
229
|
-
<a href="#
|
157
|
+
<a href="#component-instance_method" title="#component (instance method)">#<strong>component</strong>(manager = nil) ⇒ Component </a>
|
230
158
|
|
231
159
|
|
232
160
|
|
@@ -241,7 +169,7 @@
|
|
241
169
|
|
242
170
|
|
243
171
|
<span class="summary_desc"><div class='inline'>
|
244
|
-
<p>
|
172
|
+
<p>A single component from a component manager.</p>
|
245
173
|
</div></span>
|
246
174
|
|
247
175
|
</li>
|
@@ -265,7 +193,7 @@
|
|
265
193
|
|
266
194
|
|
267
195
|
<span class="summary_desc"><div class='inline'>
|
268
|
-
<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the
|
196
|
+
<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the the components attached to this entity.</p>
|
269
197
|
</div></span>
|
270
198
|
|
271
199
|
</li>
|
@@ -289,7 +217,7 @@
|
|
289
217
|
|
290
218
|
|
291
219
|
<span class="summary_desc"><div class='inline'>
|
292
|
-
<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its
|
220
|
+
<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its data.</p>
|
293
221
|
</div></span>
|
294
222
|
|
295
223
|
</li>
|
@@ -342,38 +270,13 @@
|
|
342
270
|
<p>Remove a component from the Entity.</p>
|
343
271
|
</div></span>
|
344
272
|
|
345
|
-
</li>
|
346
|
-
|
347
|
-
|
348
|
-
<li class="public ">
|
349
|
-
<span class="summary_signature">
|
350
|
-
|
351
|
-
<a href="#to_i-instance_method" title="#to_i (instance method)">#<strong>to_i</strong> ⇒ Integer </a>
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
</span>
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
<span class="summary_desc"><div class='inline'>
|
366
|
-
<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID reader</a></span>.</p>
|
367
|
-
</div></span>
|
368
|
-
|
369
273
|
</li>
|
370
274
|
|
371
275
|
|
372
276
|
</ul>
|
373
277
|
|
374
278
|
|
375
|
-
|
376
|
-
<div id="constructor_details" class="method_details_list">
|
279
|
+
<div id="constructor_details" class="method_details_list">
|
377
280
|
<h2>Constructor Details</h2>
|
378
281
|
|
379
282
|
<div class="method_details first">
|
@@ -402,7 +305,7 @@
|
|
402
305
|
<span class='name'>components</span>
|
403
306
|
|
404
307
|
|
405
|
-
<span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (
|
308
|
+
<span class='type'>(<tt><span class='object_link'><a href="Components.html" title="FelFlame::Components (module)">Components</a></span></tt>)</span>
|
406
309
|
|
407
310
|
|
408
311
|
|
@@ -422,31 +325,19 @@
|
|
422
325
|
<pre class="lines">
|
423
326
|
|
424
327
|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
21
|
431
|
-
22
|
432
|
-
23
|
433
|
-
24
|
434
|
-
25
|
435
|
-
26</pre>
|
328
|
+
8
|
329
|
+
9
|
330
|
+
10
|
331
|
+
11
|
332
|
+
12</pre>
|
436
333
|
</td>
|
437
334
|
<td>
|
438
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line
|
335
|
+
<pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 8</span>
|
439
336
|
|
440
337
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components'>components</span><span class='rparen'>)</span>
|
441
|
-
<span class='comment'># Assign new unique ID
|
442
|
-
</span> <span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_find_index'>find_index</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:nil?</span><span class='rparen'>)</span>
|
443
|
-
<span class='id identifier rubyid_new_id'>new_id</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='kw'>if</span> <span class='id identifier rubyid_new_id'>new_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
444
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_new_id'>new_id</span>
|
445
|
-
|
446
338
|
<span class='comment'># Add each component
|
447
339
|
</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components'>components</span><span class='rparen'>)</span>
|
448
|
-
|
449
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span>
|
340
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid__data'>_data</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
|
450
341
|
<span class='kw'>end</span></pre>
|
451
342
|
</td>
|
452
343
|
</tr>
|
@@ -455,76 +346,15 @@
|
|
455
346
|
|
456
347
|
</div>
|
457
348
|
|
458
|
-
<div id="instance_attr_details" class="attr_details">
|
459
|
-
<h2>Instance Attribute Details</h2>
|
460
|
-
|
461
|
-
|
462
|
-
<span id="id=-instance_method"></span>
|
463
|
-
<div class="method_details first">
|
464
|
-
<h3 class="signature first" id="id-instance_method">
|
465
|
-
|
466
|
-
#<strong>id</strong> ⇒ <tt>Integer</tt>
|
467
|
-
|
468
|
-
|
469
|
-
|
470
349
|
|
471
|
-
|
472
|
-
</
|
473
|
-
<div class="discussion">
|
474
|
-
|
475
|
-
<p>Holds the unique ID of this entity</p>
|
476
|
-
|
477
|
-
|
478
|
-
</div>
|
479
|
-
</div>
|
480
|
-
<div class="tags">
|
481
|
-
|
482
|
-
<p class="tag_title">Returns:</p>
|
483
|
-
<ul class="return">
|
484
|
-
|
485
|
-
<li>
|
486
|
-
|
487
|
-
|
488
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
</li>
|
493
|
-
|
494
|
-
</ul>
|
495
|
-
|
496
|
-
</div><table class="source_code">
|
497
|
-
<tr>
|
498
|
-
<td>
|
499
|
-
<pre class="lines">
|
500
|
-
|
501
|
-
|
502
|
-
5
|
503
|
-
6
|
504
|
-
7</pre>
|
505
|
-
</td>
|
506
|
-
<td>
|
507
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line 5</span>
|
508
|
-
|
509
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
|
510
|
-
<span class='ivar'>@id</span>
|
511
|
-
<span class='kw'>end</span></pre>
|
512
|
-
</td>
|
513
|
-
</tr>
|
514
|
-
</table>
|
515
|
-
</div>
|
516
|
-
|
517
|
-
</div>
|
518
|
-
|
519
|
-
|
520
|
-
<div id="class_method_details" class="method_details_list">
|
521
|
-
<h2>Class Method Details</h2>
|
350
|
+
<div id="instance_method_details" class="method_details_list">
|
351
|
+
<h2>Instance Method Details</h2>
|
522
352
|
|
523
353
|
|
524
354
|
<div class="method_details first">
|
525
|
-
<h3 class="signature first" id="
|
355
|
+
<h3 class="signature first" id="add-instance_method">
|
526
356
|
|
527
|
-
|
357
|
+
#<strong>add</strong>(*components_to_add) ⇒ <tt>Boolean</tt>
|
528
358
|
|
529
359
|
|
530
360
|
|
@@ -533,32 +363,28 @@
|
|
533
363
|
</h3><div class="docstring">
|
534
364
|
<div class="discussion">
|
535
365
|
|
536
|
-
<p>
|
366
|
+
<p>Add any number components to the Entity.</p>
|
537
367
|
|
538
368
|
|
539
369
|
</div>
|
540
370
|
</div>
|
541
371
|
<div class="tags">
|
542
|
-
|
543
|
-
<div class="examples">
|
544
|
-
<p class="tag_title">Examples:</p>
|
545
|
-
|
546
|
-
|
547
|
-
<pre class="example code"><code><span class='comment'># This gets the Entity with ID 7
|
548
|
-
</span><span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (class)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='lbracket'>[</span><span class='int'>7</span><span class='rbracket'>]</span></code></pre>
|
549
|
-
|
550
|
-
</div>
|
551
|
-
<p class="tag_title">Parameters:</p>
|
372
|
+
<p class="tag_title">Parameters:</p>
|
552
373
|
<ul class="param">
|
553
374
|
|
554
375
|
<li>
|
555
376
|
|
556
|
-
<span class='name'>
|
377
|
+
<span class='name'>components_to_add</span>
|
378
|
+
|
557
379
|
|
380
|
+
<span class='type'>(<tt>Component</tt>)</span>
|
558
381
|
|
559
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
560
382
|
|
561
383
|
|
384
|
+
—
|
385
|
+
<div class='inline'>
|
386
|
+
<p>Any number of components created from any component manager</p>
|
387
|
+
</div>
|
562
388
|
|
563
389
|
</li>
|
564
390
|
|
@@ -570,13 +396,13 @@
|
|
570
396
|
<li>
|
571
397
|
|
572
398
|
|
573
|
-
<span class='type'>(<tt>
|
399
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
574
400
|
|
575
401
|
|
576
402
|
|
577
403
|
—
|
578
404
|
<div class='inline'>
|
579
|
-
<p>
|
405
|
+
<p><code>true</code></p>
|
580
406
|
</div>
|
581
407
|
|
582
408
|
</li>
|
@@ -589,15 +415,37 @@
|
|
589
415
|
<pre class="lines">
|
590
416
|
|
591
417
|
|
592
|
-
|
593
|
-
|
594
|
-
|
418
|
+
57
|
419
|
+
58
|
420
|
+
59
|
421
|
+
60
|
422
|
+
61
|
423
|
+
62
|
424
|
+
63
|
425
|
+
64
|
426
|
+
65
|
427
|
+
66
|
428
|
+
67
|
429
|
+
68
|
430
|
+
69
|
431
|
+
70</pre>
|
595
432
|
</td>
|
596
433
|
<td>
|
597
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line
|
434
|
+
<pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 57</span>
|
598
435
|
|
599
|
-
<span class='kw'>def</span> <span class='
|
600
|
-
<span class='id identifier
|
436
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components_to_add'>components_to_add</span><span class='rparen'>)</span>
|
437
|
+
<span class='id identifier rubyid_components_to_add'>components_to_add</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
|
438
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
439
|
+
<span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='rbracket'>]</span>
|
440
|
+
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
|
441
|
+
<span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span>
|
442
|
+
<span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_component'>component</span>
|
443
|
+
<span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_component'>component</span>
|
444
|
+
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='kw'>self</span>
|
445
|
+
<span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span>
|
446
|
+
<span class='kw'>end</span>
|
447
|
+
<span class='kw'>end</span>
|
448
|
+
<span class='kw'>true</span>
|
601
449
|
<span class='kw'>end</span></pre>
|
602
450
|
</td>
|
603
451
|
</tr>
|
@@ -605,9 +453,9 @@
|
|
605
453
|
</div>
|
606
454
|
|
607
455
|
<div class="method_details ">
|
608
|
-
<h3 class="signature " id="
|
456
|
+
<h3 class="signature " id="component-instance_method">
|
609
457
|
|
610
|
-
|
458
|
+
#<strong>component</strong>(manager = nil) ⇒ <tt>Component</tt>
|
611
459
|
|
612
460
|
|
613
461
|
|
@@ -616,87 +464,38 @@
|
|
616
464
|
</h3><div class="docstring">
|
617
465
|
<div class="discussion">
|
618
466
|
|
619
|
-
<p>
|
467
|
+
<p>A single component from a component manager. Use this if you expect the component to only belong to one entity and you want to access it. Access the component using either parameter notation or array notation. Array notation is conventional for better readablility.</p>
|
620
468
|
|
621
469
|
|
622
470
|
</div>
|
623
471
|
</div>
|
624
472
|
<div class="tags">
|
625
473
|
|
626
|
-
<
|
627
|
-
<
|
628
|
-
|
629
|
-
<li>
|
630
|
-
|
631
|
-
|
632
|
-
<span class='type'>(<tt>Enumerator</tt>)</span>
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
</li>
|
637
|
-
|
638
|
-
</ul>
|
639
|
-
|
640
|
-
</div><table class="source_code">
|
641
|
-
<tr>
|
642
|
-
<td>
|
643
|
-
<pre class="lines">
|
644
|
-
|
645
|
-
|
646
|
-
124
|
647
|
-
125
|
648
|
-
126</pre>
|
649
|
-
</td>
|
650
|
-
<td>
|
651
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line 124</span>
|
652
|
-
|
653
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
654
|
-
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
655
|
-
<span class='kw'>end</span></pre>
|
656
|
-
</td>
|
657
|
-
</tr>
|
658
|
-
</table>
|
659
|
-
</div>
|
660
|
-
|
661
|
-
</div>
|
662
|
-
|
663
|
-
<div id="instance_method_details" class="method_details_list">
|
664
|
-
<h2>Instance Method Details</h2>
|
665
|
-
|
474
|
+
<div class="examples">
|
475
|
+
<p class="tag_title">Examples:</p>
|
666
476
|
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
#<strong>add</strong>(*components_to_add) ⇒ <tt>Boolean</tt>
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
</h3><div class="docstring">
|
677
|
-
<div class="discussion">
|
477
|
+
|
478
|
+
<pre class="example code"><code><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_component'>component</span><span class='lbracket'>[</span><span class='ivar'>@component_manager</span><span class='rbracket'>]</span> <span class='comment'># array notation(the standard)
|
479
|
+
</span><span class='ivar'>@entity</span><span class='period'>.</span><span class='id identifier rubyid_component'>component</span><span class='lparen'>(</span><span class='ivar'>@component_manager</span><span class='rparen'>)</span> <span class='comment'># method notation</span></code></pre>
|
678
480
|
|
679
|
-
<p>Add any number components to the Entity.</p>
|
680
|
-
|
681
|
-
|
682
481
|
</div>
|
683
|
-
|
684
|
-
<div class="tags">
|
685
|
-
<p class="tag_title">Parameters:</p>
|
482
|
+
<p class="tag_title">Parameters:</p>
|
686
483
|
<ul class="param">
|
687
484
|
|
688
485
|
<li>
|
689
486
|
|
690
|
-
<span class='name'>
|
487
|
+
<span class='name'>manager</span>
|
691
488
|
|
692
489
|
|
693
|
-
<span class='type'>(<tt>
|
490
|
+
<span class='type'>(<tt><span class='object_link'><a href="ComponentManager.html" title="FelFlame::ComponentManager (class)">ComponentManager</a></span></tt>)</span>
|
491
|
+
|
694
492
|
|
493
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
695
494
|
|
696
495
|
|
697
496
|
—
|
698
497
|
<div class='inline'>
|
699
|
-
<p>
|
498
|
+
<p>If you pass nil you can then use array notation to access the same value.</p>
|
700
499
|
</div>
|
701
500
|
|
702
501
|
</li>
|
@@ -709,14 +508,9 @@
|
|
709
508
|
<li>
|
710
509
|
|
711
510
|
|
712
|
-
<span class='type'>(<tt>
|
713
|
-
|
511
|
+
<span class='type'>(<tt>Component</tt>)</span>
|
714
512
|
|
715
513
|
|
716
|
-
—
|
717
|
-
<div class='inline'>
|
718
|
-
<p><code>true</code></p>
|
719
|
-
</div>
|
720
514
|
|
721
515
|
</li>
|
722
516
|
|
@@ -728,37 +522,37 @@
|
|
728
522
|
<pre class="lines">
|
729
523
|
|
730
524
|
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
525
|
+
26
|
526
|
+
27
|
527
|
+
28
|
528
|
+
29
|
529
|
+
30
|
530
|
+
31
|
531
|
+
32
|
532
|
+
33
|
533
|
+
34
|
534
|
+
35
|
535
|
+
36
|
536
|
+
37
|
537
|
+
38
|
538
|
+
39</pre>
|
745
539
|
</td>
|
746
540
|
<td>
|
747
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line
|
748
|
-
|
749
|
-
<span class='kw'>def</span> <span class='id identifier
|
750
|
-
<span class='
|
751
|
-
<span class='
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
<span class='
|
758
|
-
<span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:addition_triggers</span>
|
541
|
+
<pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 26</span>
|
542
|
+
|
543
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_component'>component</span><span class='lparen'>(</span><span class='id identifier rubyid_manager'>manager</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
544
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_manager'>manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
545
|
+
<span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_component_redirect'>component_redirect</span><span class='period'>.</span><span class='id identifier rubyid_entity'>entity</span> <span class='op'>=</span> <span class='kw'>self</span>
|
546
|
+
<span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid_component_redirect'>component_redirect</span>
|
547
|
+
<span class='kw'>else</span>
|
548
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_manager'>manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
549
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>This entity(</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='embexpr_end'>}</span><span class='tstring_content'>) doesnt have any components of this type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_manager'>manager</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
550
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_manager'>manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>1</span>
|
551
|
+
<span class='const'>Warning</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>This entity has MANY of this component but you called the method that is intended for having a single of this component type.\nYou may have a bug in your logic.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
759
552
|
<span class='kw'>end</span>
|
553
|
+
|
554
|
+
<span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_manager'>manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
760
555
|
<span class='kw'>end</span>
|
761
|
-
<span class='kw'>true</span>
|
762
556
|
<span class='kw'>end</span></pre>
|
763
557
|
</td>
|
764
558
|
</tr>
|
@@ -777,7 +571,7 @@
|
|
777
571
|
</h3><div class="docstring">
|
778
572
|
<div class="discussion">
|
779
573
|
|
780
|
-
<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the
|
574
|
+
<p>A hash that uses component manager constant names as keys, and where the values of those keys are arrays that contain the the components attached to this entity.</p>
|
781
575
|
|
782
576
|
|
783
577
|
</div>
|
@@ -804,12 +598,12 @@
|
|
804
598
|
<pre class="lines">
|
805
599
|
|
806
600
|
|
807
|
-
|
808
|
-
|
809
|
-
|
601
|
+
16
|
602
|
+
17
|
603
|
+
18</pre>
|
810
604
|
</td>
|
811
605
|
<td>
|
812
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line
|
606
|
+
<pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 16</span>
|
813
607
|
|
814
608
|
<span class='kw'>def</span> <span class='id identifier rubyid_components'>components</span>
|
815
609
|
<span class='ivar'>@components</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
@@ -831,7 +625,7 @@
|
|
831
625
|
</h3><div class="docstring">
|
832
626
|
<div class="discussion">
|
833
627
|
|
834
|
-
<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its
|
628
|
+
<p>Removes this Entity from the list and purges all references to this Entity from other Components, as well as its data.</p>
|
835
629
|
|
836
630
|
|
837
631
|
</div>
|
@@ -863,7 +657,6 @@
|
|
863
657
|
<pre class="lines">
|
864
658
|
|
865
659
|
|
866
|
-
42
|
867
660
|
43
|
868
661
|
44
|
869
662
|
45
|
@@ -873,22 +666,19 @@
|
|
873
666
|
49
|
874
667
|
50
|
875
668
|
51
|
876
|
-
52
|
877
|
-
53</pre>
|
669
|
+
52</pre>
|
878
670
|
</td>
|
879
671
|
<td>
|
880
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line
|
672
|
+
<pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 43</span>
|
881
673
|
|
882
674
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
|
883
|
-
<span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier
|
884
|
-
<span class='id identifier rubyid_component_array'>component_array</span><span class='period'>.</span><span class='id identifier
|
885
|
-
<span class='id identifier
|
886
|
-
|
887
|
-
</span> <span class='kw'>end</span>
|
675
|
+
<span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__component_manager'>_component_manager</span><span class='comma'>,</span> <span class='id identifier rubyid_component_array'>component_array</span><span class='op'>|</span>
|
676
|
+
<span class='id identifier rubyid_component_array'>component_array</span><span class='period'>.</span><span class='id identifier rubyid_reverse_each'>reverse_each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
|
677
|
+
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
678
|
+
<span class='kw'>end</span>
|
888
679
|
<span class='kw'>end</span>
|
889
|
-
<span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (
|
680
|
+
<span class='const'><span class='object_link'><a href="../FelFlame.html" title="FelFlame (module)">FelFlame</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelFlame::Entities (class)">Entities</a></span></span><span class='period'>.</span><span class='id identifier rubyid__data'>_data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
890
681
|
<span class='ivar'>@components</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
891
|
-
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
892
682
|
<span class='kw'>true</span>
|
893
683
|
<span class='kw'>end</span></pre>
|
894
684
|
</td>
|
@@ -960,6 +750,7 @@
|
|
960
750
|
<pre class="lines">
|
961
751
|
|
962
752
|
|
753
|
+
87
|
963
754
|
88
|
964
755
|
89
|
965
756
|
90
|
@@ -970,73 +761,20 @@
|
|
970
761
|
95</pre>
|
971
762
|
</td>
|
972
763
|
<td>
|
973
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line
|
764
|
+
<pre class="code"><span class="info file"># File 'lib/felflame/entity_manager.rb', line 87</span>
|
974
765
|
|
975
766
|
<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_components_to_remove'>components_to_remove</span><span class='rparen'>)</span>
|
976
767
|
<span class='id identifier rubyid_components_to_remove'>components_to_remove</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_component'>component</span><span class='op'>|</span>
|
977
|
-
<span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:removal_triggers</span> <span class='kw'>if</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='
|
978
|
-
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='
|
979
|
-
<span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span
|
768
|
+
<span class='id identifier rubyid_check_systems'>check_systems</span> <span class='id identifier rubyid_component'>component</span><span class='comma'>,</span> <span class='symbol'>:removal_triggers</span> <span class='kw'>if</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='kw'>self</span>
|
769
|
+
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
770
|
+
<span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span>
|
771
|
+
<span class='id identifier rubyid_components'>components</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='kw'>if</span> <span class='id identifier rubyid_components'>components</span><span class='lbracket'>[</span><span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
980
772
|
<span class='kw'>end</span>
|
981
773
|
<span class='kw'>true</span>
|
982
774
|
<span class='kw'>end</span></pre>
|
983
775
|
</td>
|
984
776
|
</tr>
|
985
777
|
</table>
|
986
|
-
</div>
|
987
|
-
|
988
|
-
<div class="method_details ">
|
989
|
-
<h3 class="signature " id="to_i-instance_method">
|
990
|
-
|
991
|
-
#<strong>to_i</strong> ⇒ <tt>Integer</tt>
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
</h3><div class="docstring">
|
998
|
-
<div class="discussion">
|
999
|
-
|
1000
|
-
<p>An alias for the <span class='object_link'><a href="#id-instance_method" title="FelFlame::Entities#id (method)">ID reader</a></span></p>
|
1001
|
-
|
1002
|
-
|
1003
|
-
</div>
|
1004
|
-
</div>
|
1005
|
-
<div class="tags">
|
1006
|
-
|
1007
|
-
<p class="tag_title">Returns:</p>
|
1008
|
-
<ul class="return">
|
1009
|
-
|
1010
|
-
<li>
|
1011
|
-
|
1012
|
-
|
1013
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
</li>
|
1018
|
-
|
1019
|
-
</ul>
|
1020
|
-
|
1021
|
-
</div><table class="source_code">
|
1022
|
-
<tr>
|
1023
|
-
<td>
|
1024
|
-
<pre class="lines">
|
1025
|
-
|
1026
|
-
|
1027
|
-
36
|
1028
|
-
37
|
1029
|
-
38</pre>
|
1030
|
-
</td>
|
1031
|
-
<td>
|
1032
|
-
<pre class="code"><span class="info file"># File 'entity_manager.rb', line 36</span>
|
1033
|
-
|
1034
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
|
1035
|
-
<span class='id identifier rubyid_id'>id</span>
|
1036
|
-
<span class='kw'>end</span></pre>
|
1037
|
-
</td>
|
1038
|
-
</tr>
|
1039
|
-
</table>
|
1040
778
|
</div>
|
1041
779
|
|
1042
780
|
</div>
|
@@ -1044,7 +782,7 @@
|
|
1044
782
|
</div>
|
1045
783
|
|
1046
784
|
<div id="footer">
|
1047
|
-
Generated on
|
785
|
+
Generated on Tue Feb 1 23:28:33 2022 by
|
1048
786
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1049
787
|
0.9.26 (ruby-2.7.3).
|
1050
788
|
</div>
|