felecs 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.byebug_history +20 -0
- data/.gitignore +17 -0
- data/.inch.yml +11 -0
- data/.rspec +1 -0
- data/.rubocop.yml +13 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.mdown +80 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +87 -0
- data/LICENSE +21 -0
- data/README.mdown +465 -0
- data/Rakefile +66 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docs/CNAME +1 -0
- data/docs/FelECS/ComponentManager.html +1239 -0
- data/docs/FelECS/Components.html +337 -0
- data/docs/FelECS/Entities.html +792 -0
- data/docs/FelECS/Order.html +251 -0
- data/docs/FelECS/Scenes.html +765 -0
- data/docs/FelECS/Stage.html +572 -0
- data/docs/FelECS/Systems.html +1505 -0
- data/docs/FelECS.html +335 -0
- data/docs/FelFlame/ComponentManager.html +1239 -0
- data/docs/FelFlame/Components.html +333 -0
- data/docs/FelFlame/Entities.html +792 -0
- data/docs/FelFlame/Helper/ComponentManager.html +1627 -0
- data/docs/FelFlame/Helper.html +142 -0
- data/docs/FelFlame/Order.html +251 -0
- data/docs/FelFlame/Scenes.html +765 -0
- data/docs/FelFlame/Stage.html +572 -0
- data/docs/FelFlame/Systems.html +1505 -0
- data/docs/FelFlame.html +319 -0
- data/docs/Felflame_.html +143 -0
- data/docs/_index.html +188 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +560 -0
- data/docs/file.version.html +74 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +560 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +419 -0
- data/docs/top-level-namespace.html +137 -0
- data/felecs.gemspec +45 -0
- data/lib/felecs/component_manager.rb +279 -0
- data/lib/felecs/entity_manager.rb +160 -0
- data/lib/felecs/order.rb +24 -0
- data/lib/felecs/scene_manager.rb +69 -0
- data/lib/felecs/stage_manager.rb +47 -0
- data/lib/felecs/system_manager.rb +258 -0
- data/lib/felecs/version.rb +9 -0
- data/lib/felecs.rb +67 -0
- data/mrbgem/mrbgem.rake +4 -0
- data/mrbgem/mrblib/felecs.rb +913 -0
- metadata +229 -0
@@ -0,0 +1,1505 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: FelECS::Systems
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.26
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "FelECS::Systems";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (S)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Systems</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: FelECS::Systems
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">FelECS::Systems</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/felecs.rb<span class="defines">,<br />
|
98
|
+
lib/felecs/system_manager.rb</span>
|
99
|
+
</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>Creates and manages Systems. Systems are the logic of the game and do not contain any data within them. Any systems you create are accessable under the <span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span> namespace as Constants. You can use array methods directly on this class to access Systems.</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
120
|
+
<ul class="summary">
|
121
|
+
|
122
|
+
<li class="public ">
|
123
|
+
<span class="summary_signature">
|
124
|
+
|
125
|
+
<a href="#addition_triggers-instance_method" title="#addition_triggers (instance method)">#<strong>addition_triggers</strong> ⇒ Array<Component> </a>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
</span>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="note title readonly">readonly</span>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="summary_desc"><div class='inline'>
|
145
|
+
<p>Stores references to components or their managers that trigger this component when a component or component from that manager is added to an entity.</p>
|
146
|
+
</div></span>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#attr_triggers-instance_method" title="#attr_triggers (instance method)">#<strong>attr_triggers</strong> ⇒ Hash<Symbol, Array<Symbol>> </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<span class="note title readonly">readonly</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
<span class="summary_desc"><div class='inline'>
|
174
|
+
<p>Stores references to systems that should be triggered when an attribute from this manager is changed Do not edit this hash as it is managed by FelECS automatically.</p>
|
175
|
+
</div></span>
|
176
|
+
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
<li class="public ">
|
181
|
+
<span class="summary_signature">
|
182
|
+
|
183
|
+
<a href="#priority-instance_method" title="#priority (instance method)">#<strong>priority</strong> ⇒ Object </a>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
</span>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'>
|
201
|
+
<p>How early this System should be executed in a list of Systems.</p>
|
202
|
+
</div></span>
|
203
|
+
|
204
|
+
</li>
|
205
|
+
|
206
|
+
|
207
|
+
<li class="public ">
|
208
|
+
<span class="summary_signature">
|
209
|
+
|
210
|
+
<a href="#removal_triggers-instance_method" title="#removal_triggers (instance method)">#<strong>removal_triggers</strong> ⇒ Array<Component> </a>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
</span>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="note title readonly">readonly</span>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<span class="summary_desc"><div class='inline'>
|
230
|
+
<p>Stores references to components or their managers that trigger this component when a component or component from that manager is removed from an entity.</p>
|
231
|
+
</div></span>
|
232
|
+
|
233
|
+
</li>
|
234
|
+
|
235
|
+
|
236
|
+
<li class="public ">
|
237
|
+
<span class="summary_signature">
|
238
|
+
|
239
|
+
<a href="#scenes-instance_method" title="#scenes (instance method)">#<strong>scenes</strong> ⇒ Object </a>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
</span>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
257
|
+
|
258
|
+
</li>
|
259
|
+
|
260
|
+
|
261
|
+
</ul>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
<h2>
|
268
|
+
Class Method Summary
|
269
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
270
|
+
</h2>
|
271
|
+
|
272
|
+
<ul class="summary">
|
273
|
+
|
274
|
+
<li class="public ">
|
275
|
+
<span class="summary_signature">
|
276
|
+
|
277
|
+
<a href="#const_cache-class_method" title="const_cache (class method)">.<strong>const_cache</strong> ⇒ Object </a>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
</span>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
<span class="summary_desc"><div class='inline'>
|
292
|
+
<p>Stores the systems in <span class='object_link'><a href="Components.html" title="FelECS::Components (module)">Components</a></span>.</p>
|
293
|
+
</div></span>
|
294
|
+
|
295
|
+
</li>
|
296
|
+
|
297
|
+
|
298
|
+
</ul>
|
299
|
+
|
300
|
+
<h2>
|
301
|
+
Instance Method Summary
|
302
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
303
|
+
</h2>
|
304
|
+
|
305
|
+
<ul class="summary">
|
306
|
+
|
307
|
+
<li class="public ">
|
308
|
+
<span class="summary_signature">
|
309
|
+
|
310
|
+
<a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong> ⇒ Object </a>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
</span>
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
<span class="summary_desc"><div class='inline'>
|
325
|
+
<p>Manually execute the system a single time.</p>
|
326
|
+
</div></span>
|
327
|
+
|
328
|
+
</li>
|
329
|
+
|
330
|
+
|
331
|
+
<li class="public ">
|
332
|
+
<span class="summary_signature">
|
333
|
+
|
334
|
+
<a href="#clear_triggers-instance_method" title="#clear_triggers (instance method)">#<strong>clear_triggers</strong>(*trigger_types, component_or_manager: nil) ⇒ Boolean </a>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
</span>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
<span class="summary_desc"><div class='inline'>
|
349
|
+
<p>Removes triggers from this system.</p>
|
350
|
+
</div></span>
|
351
|
+
|
352
|
+
</li>
|
353
|
+
|
354
|
+
|
355
|
+
<li class="public ">
|
356
|
+
<span class="summary_signature">
|
357
|
+
|
358
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name, priority: 0, &block) ⇒ Systems </a>
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
</span>
|
363
|
+
|
364
|
+
|
365
|
+
<span class="note title constructor">constructor</span>
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
<span class="summary_desc"><div class='inline'>
|
375
|
+
<p>Creates a new System which can be accessed as a constant under the namespace <span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span>.</p>
|
376
|
+
</div></span>
|
377
|
+
|
378
|
+
</li>
|
379
|
+
|
380
|
+
|
381
|
+
<li class="public ">
|
382
|
+
<span class="summary_signature">
|
383
|
+
|
384
|
+
<a href="#redefine-instance_method" title="#redefine (instance method)">#<strong>redefine</strong>(&block) ⇒ Object </a>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
</span>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
<span class="summary_desc"><div class='inline'>
|
399
|
+
<p>Redefine what code is executed by this System when it is called upon.</p>
|
400
|
+
</div></span>
|
401
|
+
|
402
|
+
</li>
|
403
|
+
|
404
|
+
|
405
|
+
<li class="public ">
|
406
|
+
<span class="summary_signature">
|
407
|
+
|
408
|
+
<a href="#trigger_when_added-instance_method" title="#trigger_when_added (instance method)">#<strong>trigger_when_added</strong>(component_or_manager) ⇒ Boolean </a>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
</span>
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
<span class="summary_desc"><div class='inline'>
|
423
|
+
<p>Add a component or component manager so that it triggers this system when the component or a component from the component manager is added to an entity.</p>
|
424
|
+
</div></span>
|
425
|
+
|
426
|
+
</li>
|
427
|
+
|
428
|
+
|
429
|
+
<li class="public ">
|
430
|
+
<span class="summary_signature">
|
431
|
+
|
432
|
+
<a href="#trigger_when_is_changed-instance_method" title="#trigger_when_is_changed (instance method)">#<strong>trigger_when_is_changed</strong>(component_or_manager, attr) ⇒ Boolean </a>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
</span>
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
<span class="summary_desc"><div class='inline'>
|
447
|
+
<p>Add a component or component manager so that it triggers this system when a component's attribute is changed.</p>
|
448
|
+
</div></span>
|
449
|
+
|
450
|
+
</li>
|
451
|
+
|
452
|
+
|
453
|
+
<li class="public ">
|
454
|
+
<span class="summary_signature">
|
455
|
+
|
456
|
+
<a href="#trigger_when_removed-instance_method" title="#trigger_when_removed (instance method)">#<strong>trigger_when_removed</strong>(component_or_manager) ⇒ Boolean </a>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
</span>
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
<span class="summary_desc"><div class='inline'>
|
471
|
+
<p>Add a component or component manager so that it triggers this system when the component or a component from the component manager is removed from an entity.</p>
|
472
|
+
</div></span>
|
473
|
+
|
474
|
+
</li>
|
475
|
+
|
476
|
+
|
477
|
+
</ul>
|
478
|
+
|
479
|
+
|
480
|
+
<div id="constructor_details" class="method_details_list">
|
481
|
+
<h2>Constructor Details</h2>
|
482
|
+
|
483
|
+
<div class="method_details first">
|
484
|
+
<h3 class="signature first" id="initialize-instance_method">
|
485
|
+
|
486
|
+
#<strong>initialize</strong>(name, priority: 0, &block) ⇒ <tt><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></tt>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
</h3><div class="docstring">
|
493
|
+
<div class="discussion">
|
494
|
+
|
495
|
+
<p>Creates a new System which can be accessed as a constant under the namespace <span class='object_link'><a href="" title="FelECS::Systems (class)">FelECS::Systems</a></span>. The name given is what constant the system is assigned to</p>
|
496
|
+
|
497
|
+
|
498
|
+
</div>
|
499
|
+
</div>
|
500
|
+
<div class="tags">
|
501
|
+
|
502
|
+
<div class="examples">
|
503
|
+
<p class="tag_title">Examples:</p>
|
504
|
+
|
505
|
+
|
506
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>PassiveHeal</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='op'>-</span><span class='int'>2</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
507
|
+
<span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Components.html" title="FelECS::Components (module)">Components</a></span></span><span class='op'>::</span><span class='const'>Health</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>
|
508
|
+
<span class='id identifier rubyid_component'>component</span><span class='period'>.</span><span class='id identifier rubyid_hp'>hp</span> <span class='op'>+=</span> <span class='int'>5</span>
|
509
|
+
<span class='kw'>end</span>
|
510
|
+
<span class='kw'>end</span>
|
511
|
+
<span class='comment'># Give it a low priority so other systems such as a
|
512
|
+
</span><span class='comment'># Poison system would kill the player first</span></code></pre>
|
513
|
+
|
514
|
+
</div>
|
515
|
+
<p class="tag_title">Parameters:</p>
|
516
|
+
<ul class="param">
|
517
|
+
|
518
|
+
<li>
|
519
|
+
|
520
|
+
<span class='name'>name</span>
|
521
|
+
|
522
|
+
|
523
|
+
<span class='type'>(<tt>String</tt>)</span>
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
—
|
528
|
+
<div class='inline'>
|
529
|
+
<p>The name this system will use. Needs to to be in the Ruby Constant format.</p>
|
530
|
+
</div>
|
531
|
+
|
532
|
+
</li>
|
533
|
+
|
534
|
+
<li>
|
535
|
+
|
536
|
+
<span class='name'>priority</span>
|
537
|
+
|
538
|
+
|
539
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
540
|
+
|
541
|
+
|
542
|
+
<em class="default">(defaults to: <tt>0</tt>)</em>
|
543
|
+
|
544
|
+
|
545
|
+
—
|
546
|
+
<div class='inline'>
|
547
|
+
<p>Which priority order this system should be executed in relative to other systems. Higher means executed earlier.</p>
|
548
|
+
</div>
|
549
|
+
|
550
|
+
</li>
|
551
|
+
|
552
|
+
<li>
|
553
|
+
|
554
|
+
<span class='name'>block</span>
|
555
|
+
|
556
|
+
|
557
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
—
|
562
|
+
<div class='inline'>
|
563
|
+
<p>The code you wish to be executed when the system is triggered. Can be defined by using a <tt>do end</tt> block or using <tt>{ }</tt> braces.</p>
|
564
|
+
</div>
|
565
|
+
|
566
|
+
</li>
|
567
|
+
|
568
|
+
</ul>
|
569
|
+
|
570
|
+
|
571
|
+
</div><table class="source_code">
|
572
|
+
<tr>
|
573
|
+
<td>
|
574
|
+
<pre class="lines">
|
575
|
+
|
576
|
+
|
577
|
+
115
|
578
|
+
116
|
579
|
+
117
|
580
|
+
118
|
581
|
+
119
|
582
|
+
120
|
583
|
+
121</pre>
|
584
|
+
</td>
|
585
|
+
<td>
|
586
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 115</span>
|
587
|
+
|
588
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
589
|
+
<span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_const_set'>const_set</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span>
|
590
|
+
<span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='period'>.</span><span class='id identifier rubyid_update_const_cache'>update_const_cache</span>
|
591
|
+
<span class='ivar'>@priority</span> <span class='op'>=</span> <span class='id identifier rubyid_priority'>priority</span>
|
592
|
+
<span class='ivar'>@block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
593
|
+
<span class='ivar'>@scenes</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
594
|
+
<span class='kw'>end</span></pre>
|
595
|
+
</td>
|
596
|
+
</tr>
|
597
|
+
</table>
|
598
|
+
</div>
|
599
|
+
|
600
|
+
</div>
|
601
|
+
|
602
|
+
<div id="instance_attr_details" class="attr_details">
|
603
|
+
<h2>Instance Attribute Details</h2>
|
604
|
+
|
605
|
+
|
606
|
+
<span id="addition_triggers=-instance_method"></span>
|
607
|
+
<div class="method_details first">
|
608
|
+
<h3 class="signature first" id="addition_triggers-instance_method">
|
609
|
+
|
610
|
+
#<strong>addition_triggers</strong> ⇒ <tt>Array<Component></tt>
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
</h3><div class="docstring">
|
617
|
+
<div class="discussion">
|
618
|
+
|
619
|
+
<p>Stores references to components or their managers that trigger this component when a component or component from that manager is added to an entity. Do not edit this hash as it is managed by FelECS automatically.</p>
|
620
|
+
|
621
|
+
|
622
|
+
</div>
|
623
|
+
</div>
|
624
|
+
<div class="tags">
|
625
|
+
|
626
|
+
<p class="tag_title">Returns:</p>
|
627
|
+
<ul class="return">
|
628
|
+
|
629
|
+
<li>
|
630
|
+
|
631
|
+
|
632
|
+
<span class='type'>(<tt>Array<Component></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
|
+
35
|
647
|
+
36
|
648
|
+
37</pre>
|
649
|
+
</td>
|
650
|
+
<td>
|
651
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 35</span>
|
652
|
+
|
653
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_addition_triggers'>addition_triggers</span>
|
654
|
+
<span class='ivar'>@addition_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
655
|
+
<span class='kw'>end</span></pre>
|
656
|
+
</td>
|
657
|
+
</tr>
|
658
|
+
</table>
|
659
|
+
</div>
|
660
|
+
|
661
|
+
|
662
|
+
<span id="attr_triggers=-instance_method"></span>
|
663
|
+
<div class="method_details ">
|
664
|
+
<h3 class="signature " id="attr_triggers-instance_method">
|
665
|
+
|
666
|
+
#<strong>attr_triggers</strong> ⇒ <tt>Hash<Symbol, Array<Symbol>></tt>
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
</h3><div class="docstring">
|
673
|
+
<div class="discussion">
|
674
|
+
|
675
|
+
<p>Stores references to systems that should be triggered when an attribute from this manager is changed Do not edit this hash as it is managed by FelECS automatically.</p>
|
676
|
+
|
677
|
+
|
678
|
+
</div>
|
679
|
+
</div>
|
680
|
+
<div class="tags">
|
681
|
+
|
682
|
+
<p class="tag_title">Returns:</p>
|
683
|
+
<ul class="return">
|
684
|
+
|
685
|
+
<li>
|
686
|
+
|
687
|
+
|
688
|
+
<span class='type'>(<tt>Hash<Symbol, Array<Symbol>></tt>)</span>
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
</li>
|
693
|
+
|
694
|
+
</ul>
|
695
|
+
|
696
|
+
</div><table class="source_code">
|
697
|
+
<tr>
|
698
|
+
<td>
|
699
|
+
<pre class="lines">
|
700
|
+
|
701
|
+
|
702
|
+
52
|
703
|
+
53
|
704
|
+
54</pre>
|
705
|
+
</td>
|
706
|
+
<td>
|
707
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 52</span>
|
708
|
+
|
709
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span>
|
710
|
+
<span class='ivar'>@attr_triggers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
711
|
+
<span class='kw'>end</span></pre>
|
712
|
+
</td>
|
713
|
+
</tr>
|
714
|
+
</table>
|
715
|
+
</div>
|
716
|
+
|
717
|
+
|
718
|
+
<span id="priority=-instance_method"></span>
|
719
|
+
<div class="method_details ">
|
720
|
+
<h3 class="signature " id="priority-instance_method">
|
721
|
+
|
722
|
+
#<strong>priority</strong> ⇒ <tt>Object</tt>
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
|
727
|
+
|
728
|
+
</h3><div class="docstring">
|
729
|
+
<div class="discussion">
|
730
|
+
|
731
|
+
<p>How early this System should be executed in a list of Systems</p>
|
732
|
+
|
733
|
+
|
734
|
+
</div>
|
735
|
+
</div>
|
736
|
+
<div class="tags">
|
737
|
+
|
738
|
+
|
739
|
+
</div><table class="source_code">
|
740
|
+
<tr>
|
741
|
+
<td>
|
742
|
+
<pre class="lines">
|
743
|
+
|
744
|
+
|
745
|
+
6
|
746
|
+
7
|
747
|
+
8</pre>
|
748
|
+
</td>
|
749
|
+
<td>
|
750
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 6</span>
|
751
|
+
|
752
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_priority'>priority</span>
|
753
|
+
<span class='ivar'>@priority</span>
|
754
|
+
<span class='kw'>end</span></pre>
|
755
|
+
</td>
|
756
|
+
</tr>
|
757
|
+
</table>
|
758
|
+
</div>
|
759
|
+
|
760
|
+
|
761
|
+
<span id="removal_triggers=-instance_method"></span>
|
762
|
+
<div class="method_details ">
|
763
|
+
<h3 class="signature " id="removal_triggers-instance_method">
|
764
|
+
|
765
|
+
#<strong>removal_triggers</strong> ⇒ <tt>Array<Component></tt>
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
|
770
|
+
|
771
|
+
</h3><div class="docstring">
|
772
|
+
<div class="discussion">
|
773
|
+
|
774
|
+
<p>Stores references to components or their managers that trigger this component when a component or component from that manager is removed from an entity. Do not edit this hash as it is managed by FelECS automatically.</p>
|
775
|
+
|
776
|
+
|
777
|
+
</div>
|
778
|
+
</div>
|
779
|
+
<div class="tags">
|
780
|
+
|
781
|
+
<p class="tag_title">Returns:</p>
|
782
|
+
<ul class="return">
|
783
|
+
|
784
|
+
<li>
|
785
|
+
|
786
|
+
|
787
|
+
<span class='type'>(<tt>Array<Component></tt>)</span>
|
788
|
+
|
789
|
+
|
790
|
+
|
791
|
+
</li>
|
792
|
+
|
793
|
+
</ul>
|
794
|
+
|
795
|
+
</div><table class="source_code">
|
796
|
+
<tr>
|
797
|
+
<td>
|
798
|
+
<pre class="lines">
|
799
|
+
|
800
|
+
|
801
|
+
44
|
802
|
+
45
|
803
|
+
46</pre>
|
804
|
+
</td>
|
805
|
+
<td>
|
806
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 44</span>
|
807
|
+
|
808
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_removal_triggers'>removal_triggers</span>
|
809
|
+
<span class='ivar'>@removal_triggers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
810
|
+
<span class='kw'>end</span></pre>
|
811
|
+
</td>
|
812
|
+
</tr>
|
813
|
+
</table>
|
814
|
+
</div>
|
815
|
+
|
816
|
+
|
817
|
+
<span id="scenes=-instance_method"></span>
|
818
|
+
<div class="method_details ">
|
819
|
+
<h3 class="signature " id="scenes-instance_method">
|
820
|
+
|
821
|
+
#<strong>scenes</strong> ⇒ <tt>Object</tt>
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
</h3><table class="source_code">
|
828
|
+
<tr>
|
829
|
+
<td>
|
830
|
+
<pre class="lines">
|
831
|
+
|
832
|
+
|
833
|
+
19
|
834
|
+
20
|
835
|
+
21</pre>
|
836
|
+
</td>
|
837
|
+
<td>
|
838
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 19</span>
|
839
|
+
|
840
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scenes'>scenes</span>
|
841
|
+
<span class='ivar'>@scenes</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
842
|
+
<span class='kw'>end</span></pre>
|
843
|
+
</td>
|
844
|
+
</tr>
|
845
|
+
</table>
|
846
|
+
</div>
|
847
|
+
|
848
|
+
</div>
|
849
|
+
|
850
|
+
|
851
|
+
<div id="class_method_details" class="method_details_list">
|
852
|
+
<h2>Class Method Details</h2>
|
853
|
+
|
854
|
+
|
855
|
+
<div class="method_details first">
|
856
|
+
<h3 class="signature first" id="const_cache-class_method">
|
857
|
+
|
858
|
+
.<strong>const_cache</strong> ⇒ <tt>Object</tt>
|
859
|
+
|
860
|
+
|
861
|
+
|
862
|
+
|
863
|
+
|
864
|
+
</h3><div class="docstring">
|
865
|
+
<div class="discussion">
|
866
|
+
|
867
|
+
<p>Stores the systems in <span class='object_link'><a href="Components.html" title="FelECS::Components (module)">Components</a></span>. This is needed because calling `FelECS::Components.constants` will not let you iterate over the value of the constants but will instead give you an array of symbols. This caches the convertion of those symbols to the actual value of the constants</p>
|
868
|
+
|
869
|
+
|
870
|
+
</div>
|
871
|
+
</div>
|
872
|
+
<div class="tags">
|
873
|
+
|
874
|
+
|
875
|
+
</div><table class="source_code">
|
876
|
+
<tr>
|
877
|
+
<td>
|
878
|
+
<pre class="lines">
|
879
|
+
|
880
|
+
|
881
|
+
63
|
882
|
+
64
|
883
|
+
65</pre>
|
884
|
+
</td>
|
885
|
+
<td>
|
886
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 63</span>
|
887
|
+
|
888
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_const_cache'>const_cache</span>
|
889
|
+
<span class='ivar'>@const_cache</span> <span class='op'>||</span> <span class='id identifier rubyid_update_const_cache'>update_const_cache</span>
|
890
|
+
<span class='kw'>end</span></pre>
|
891
|
+
</td>
|
892
|
+
</tr>
|
893
|
+
</table>
|
894
|
+
</div>
|
895
|
+
|
896
|
+
</div>
|
897
|
+
|
898
|
+
<div id="instance_method_details" class="method_details_list">
|
899
|
+
<h2>Instance Method Details</h2>
|
900
|
+
|
901
|
+
|
902
|
+
<div class="method_details first">
|
903
|
+
<h3 class="signature first" id="call-instance_method">
|
904
|
+
|
905
|
+
#<strong>call</strong> ⇒ <tt>Object</tt>
|
906
|
+
|
907
|
+
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
</h3><div class="docstring">
|
912
|
+
<div class="discussion">
|
913
|
+
|
914
|
+
<p>Manually execute the system a single time</p>
|
915
|
+
|
916
|
+
|
917
|
+
</div>
|
918
|
+
</div>
|
919
|
+
<div class="tags">
|
920
|
+
|
921
|
+
|
922
|
+
</div><table class="source_code">
|
923
|
+
<tr>
|
924
|
+
<td>
|
925
|
+
<pre class="lines">
|
926
|
+
|
927
|
+
|
928
|
+
124
|
929
|
+
125
|
930
|
+
126</pre>
|
931
|
+
</td>
|
932
|
+
<td>
|
933
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 124</span>
|
934
|
+
|
935
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span>
|
936
|
+
<span class='ivar'>@block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
|
937
|
+
<span class='kw'>end</span></pre>
|
938
|
+
</td>
|
939
|
+
</tr>
|
940
|
+
</table>
|
941
|
+
</div>
|
942
|
+
|
943
|
+
<div class="method_details ">
|
944
|
+
<h3 class="signature " id="clear_triggers-instance_method">
|
945
|
+
|
946
|
+
#<strong>clear_triggers</strong>(*trigger_types, component_or_manager: nil) ⇒ <tt>Boolean</tt>
|
947
|
+
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
|
952
|
+
</h3><div class="docstring">
|
953
|
+
<div class="discussion">
|
954
|
+
|
955
|
+
<p>Removes triggers from this system. This function is fairly flexible so it can accept a few different inputs For addition and removal triggers, you can optionally pass in a component, or a manager to clear specifically the relevant triggers for that one component or manager. If you do not pass a component or manager then it will clear triggers for all components and managers. For attr_triggers</p>
|
956
|
+
|
957
|
+
|
958
|
+
</div>
|
959
|
+
</div>
|
960
|
+
<div class="tags">
|
961
|
+
|
962
|
+
<div class="examples">
|
963
|
+
<p class="tag_title">Examples:</p>
|
964
|
+
|
965
|
+
|
966
|
+
<pre class="example code"><code><span class='comment'># To clear all triggers that execute this system when a component is added:
|
967
|
+
</span><span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span>
|
968
|
+
<span class='comment'># Same as above but for when a component is removed instead
|
969
|
+
</span><span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:removal_triggers</span>
|
970
|
+
<span class='comment'># Same as above but for when a component has a certain attribute changed
|
971
|
+
</span><span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:attr_triggers</span>
|
972
|
+
|
973
|
+
<span class='comment'># Clear a trigger from a specific component
|
974
|
+
</span><span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='op'>::</span><span class='const'>ExampleComponent</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
975
|
+
<span class='comment'># Clear a trigger from a specific component manager
|
976
|
+
</span><span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:addition_triggers</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'>Component</span><span class='op'>::</span><span class='const'>ExampleComponent</span>
|
977
|
+
|
978
|
+
<span class='comment'># Clear the trigger that executes a system when the ':example_attr' is changes
|
979
|
+
</span><span class='const'><span class='object_link'><a href="../FelECS.html" title="FelECS (module)">FelECS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="FelECS::Systems (class)">Systems</a></span></span><span class='op'>::</span><span class='const'>ExampleSystem</span><span class='period'>.</span><span class='id identifier rubyid_clear_triggers'>clear_triggers</span> <span class='symbol'>:attr_triggers</span><span class='comma'>,</span> <span class='symbol'>:example_attr</span></code></pre>
|
980
|
+
|
981
|
+
</div>
|
982
|
+
<p class="tag_title">Parameters:</p>
|
983
|
+
<ul class="param">
|
984
|
+
|
985
|
+
<li>
|
986
|
+
|
987
|
+
<span class='name'>trigger_types</span>
|
988
|
+
|
989
|
+
|
990
|
+
<span class='type'>(<tt>:Symbols</tt>)</span>
|
991
|
+
|
992
|
+
|
993
|
+
|
994
|
+
—
|
995
|
+
<div class='inline'>
|
996
|
+
<p>One or more of the following trigger types: <code>:addition_triggers</code>, <code>:removal_triggers</code>, or <code>:attr_triggers</code>. If attr_triggers is used then you may pass attributes you wish to be cleared as symbols in this parameter as well</p>
|
997
|
+
</div>
|
998
|
+
|
999
|
+
</li>
|
1000
|
+
|
1001
|
+
<li>
|
1002
|
+
|
1003
|
+
<span class='name'>component_or_manager</span>
|
1004
|
+
|
1005
|
+
|
1006
|
+
<span class='type'>(<tt>Component or <span class='object_link'><a href="ComponentManager.html" title="FelECS::ComponentManager (class)">ComponentManager</a></span></tt>)</span>
|
1007
|
+
|
1008
|
+
|
1009
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1010
|
+
|
1011
|
+
|
1012
|
+
—
|
1013
|
+
<div class='inline'>
|
1014
|
+
<p>The object to clear triggers from. Use Nil to clear triggers from all components associated with this system.</p>
|
1015
|
+
</div>
|
1016
|
+
|
1017
|
+
</li>
|
1018
|
+
|
1019
|
+
</ul>
|
1020
|
+
|
1021
|
+
<p class="tag_title">Returns:</p>
|
1022
|
+
<ul class="return">
|
1023
|
+
|
1024
|
+
<li>
|
1025
|
+
|
1026
|
+
|
1027
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1028
|
+
|
1029
|
+
|
1030
|
+
|
1031
|
+
—
|
1032
|
+
<div class='inline'>
|
1033
|
+
<p><code>true</code></p>
|
1034
|
+
</div>
|
1035
|
+
|
1036
|
+
</li>
|
1037
|
+
|
1038
|
+
</ul>
|
1039
|
+
|
1040
|
+
</div><table class="source_code">
|
1041
|
+
<tr>
|
1042
|
+
<td>
|
1043
|
+
<pre class="lines">
|
1044
|
+
|
1045
|
+
|
1046
|
+
157
|
1047
|
+
158
|
1048
|
+
159
|
1049
|
+
160
|
1050
|
+
161
|
1051
|
+
162
|
1052
|
+
163
|
1053
|
+
164
|
1054
|
+
165
|
1055
|
+
166
|
1056
|
+
167
|
1057
|
+
168
|
1058
|
+
169
|
1059
|
+
170
|
1060
|
+
171
|
1061
|
+
172
|
1062
|
+
173
|
1063
|
+
174
|
1064
|
+
175
|
1065
|
+
176
|
1066
|
+
177
|
1067
|
+
178
|
1068
|
+
179
|
1069
|
+
180
|
1070
|
+
181
|
1071
|
+
182
|
1072
|
+
183
|
1073
|
+
184
|
1074
|
+
185
|
1075
|
+
186
|
1076
|
+
187
|
1077
|
+
188
|
1078
|
+
189
|
1079
|
+
190
|
1080
|
+
191
|
1081
|
+
192
|
1082
|
+
193
|
1083
|
+
194
|
1084
|
+
195
|
1085
|
+
196
|
1086
|
+
197
|
1087
|
+
198
|
1088
|
+
199
|
1089
|
+
200
|
1090
|
+
201
|
1091
|
+
202
|
1092
|
+
203
|
1093
|
+
204
|
1094
|
+
205
|
1095
|
+
206
|
1096
|
+
207
|
1097
|
+
208
|
1098
|
+
209
|
1099
|
+
210
|
1100
|
+
211
|
1101
|
+
212
|
1102
|
+
213
|
1103
|
+
214
|
1104
|
+
215
|
1105
|
+
216
|
1106
|
+
217
|
1107
|
+
218
|
1108
|
+
219
|
1109
|
+
220
|
1110
|
+
221
|
1111
|
+
222</pre>
|
1112
|
+
</td>
|
1113
|
+
<td>
|
1114
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 157</span>
|
1115
|
+
|
1116
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_clear_triggers'>clear_triggers</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_trigger_types'>trigger_types</span><span class='comma'>,</span> <span class='label'>component_or_manager:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1117
|
+
<span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>=</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'> </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1118
|
+
|
1119
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='symbol'>:attr_triggers</span>
|
1120
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'>
|
1121
|
+
</span><span class='tstring_content'>removal_triggers</span><span class='words_sep'>
|
1122
|
+
</span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1123
|
+
|
1124
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1125
|
+
<span class='comment'># remove all attrs
|
1126
|
+
</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</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_cmp_or_mgr'>cmp_or_mgr</span><span class='comma'>,</span> <span class='id identifier rubyid_attrs'>attrs</span><span class='op'>|</span>
|
1127
|
+
<span class='id identifier rubyid_attrs'>attrs</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_attr'>attr</span><span class='op'>|</span>
|
1128
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1129
|
+
|
1130
|
+
<span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
1131
|
+
<span class='kw'>end</span>
|
1132
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1133
|
+
<span class='kw'>end</span>
|
1134
|
+
<span class='kw'>else</span>
|
1135
|
+
<span class='comment'># remove attrs relevant to comp_or_man
|
1136
|
+
</span> <span class='kw'>unless</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1137
|
+
<span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</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_attr'>attr</span><span class='op'>|</span>
|
1138
|
+
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
1139
|
+
<span class='kw'>end</span>
|
1140
|
+
<span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1141
|
+
<span class='kw'>end</span>
|
1142
|
+
<span class='kw'>end</span>
|
1143
|
+
|
1144
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1145
|
+
|
1146
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'> </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</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_attr'>attr</span><span class='op'>|</span>
|
1147
|
+
<span class='comment'># remove attr
|
1148
|
+
</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</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_cmp_or_mgr'>cmp_or_mgr</span><span class='comma'>,</span> <span class='id identifier rubyid__attrs'>_attrs</span><span class='op'>|</span>
|
1149
|
+
<span class='id identifier rubyid_cmp_or_mgr'>cmp_or_mgr</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
1150
|
+
<span class='kw'>end</span>
|
1151
|
+
<span class='kw'>end</span>
|
1152
|
+
<span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'>
|
1153
|
+
</span><span class='tstring_content'>removal_triggers</span><span class='words_sep'>
|
1154
|
+
</span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</span>
|
1155
|
+
<span class='kw'>else</span>
|
1156
|
+
<span class='comment'># remove attr from component_or_manager
|
1157
|
+
</span> <span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>-</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>addition_triggers</span><span class='words_sep'> </span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>attr_triggers</span><span class='tstring_end'>]</span></span><span class='rparen'>)</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_attr'>attr</span><span class='op'>|</span>
|
1158
|
+
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1159
|
+
|
1160
|
+
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
1161
|
+
<span class='kw'>end</span>
|
1162
|
+
<span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>-=</span> <span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='kw'>unless</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1163
|
+
|
1164
|
+
<span class='kw'>end</span>
|
1165
|
+
<span class='kw'>end</span>
|
1166
|
+
|
1167
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_trigger_types'>trigger_types</span> <span class='op'>&</span> <span class='qsymbols_beg'>%i[</span><span class='tstring_content'>removal_triggers</span><span class='words_sep'> </span><span class='tstring_content'>addition_triggers</span><span class='tstring_end'>]</span></span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='symbol'>:attr_triggers</span><span class='rbracket'>]</span><span class='rparen'>)</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_trigger_type'>trigger_type</span><span class='op'>|</span>
|
1168
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1169
|
+
<span class='comment'># remove all removal triggers
|
1170
|
+
</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</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_trigger'>trigger</span><span class='op'>|</span>
|
1171
|
+
<span class='id identifier rubyid_trigger'>trigger</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
1172
|
+
<span class='kw'>end</span>
|
1173
|
+
<span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1174
|
+
<span class='kw'>else</span>
|
1175
|
+
<span class='comment'># remove removal trigger relevant to comp/man
|
1176
|
+
</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span>
|
1177
|
+
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_trigger_type'>trigger_type</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>self</span>
|
1178
|
+
<span class='kw'>end</span>
|
1179
|
+
<span class='kw'>end</span>
|
1180
|
+
<span class='kw'>true</span>
|
1181
|
+
<span class='kw'>end</span></pre>
|
1182
|
+
</td>
|
1183
|
+
</tr>
|
1184
|
+
</table>
|
1185
|
+
</div>
|
1186
|
+
|
1187
|
+
<div class="method_details ">
|
1188
|
+
<h3 class="signature " id="redefine-instance_method">
|
1189
|
+
|
1190
|
+
#<strong>redefine</strong>(&block) ⇒ <tt>Object</tt>
|
1191
|
+
|
1192
|
+
|
1193
|
+
|
1194
|
+
|
1195
|
+
|
1196
|
+
</h3><div class="docstring">
|
1197
|
+
<div class="discussion">
|
1198
|
+
|
1199
|
+
<p>Redefine what code is executed by this System when it is called upon.</p>
|
1200
|
+
|
1201
|
+
|
1202
|
+
</div>
|
1203
|
+
</div>
|
1204
|
+
<div class="tags">
|
1205
|
+
<p class="tag_title">Parameters:</p>
|
1206
|
+
<ul class="param">
|
1207
|
+
|
1208
|
+
<li>
|
1209
|
+
|
1210
|
+
<span class='name'>block</span>
|
1211
|
+
|
1212
|
+
|
1213
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
1214
|
+
|
1215
|
+
|
1216
|
+
|
1217
|
+
—
|
1218
|
+
<div class='inline'>
|
1219
|
+
<p>The code you wish to be executed when the system is triggered. Can be defined by using a <tt>do end</tt> block or using <tt>{ }</tt> braces.</p>
|
1220
|
+
</div>
|
1221
|
+
|
1222
|
+
</li>
|
1223
|
+
|
1224
|
+
</ul>
|
1225
|
+
|
1226
|
+
|
1227
|
+
</div><table class="source_code">
|
1228
|
+
<tr>
|
1229
|
+
<td>
|
1230
|
+
<pre class="lines">
|
1231
|
+
|
1232
|
+
|
1233
|
+
130
|
1234
|
+
131
|
1235
|
+
132</pre>
|
1236
|
+
</td>
|
1237
|
+
<td>
|
1238
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 130</span>
|
1239
|
+
|
1240
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redefine'>redefine</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1241
|
+
<span class='ivar'>@block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
|
1242
|
+
<span class='kw'>end</span></pre>
|
1243
|
+
</td>
|
1244
|
+
</tr>
|
1245
|
+
</table>
|
1246
|
+
</div>
|
1247
|
+
|
1248
|
+
<div class="method_details ">
|
1249
|
+
<h3 class="signature " id="trigger_when_added-instance_method">
|
1250
|
+
|
1251
|
+
#<strong>trigger_when_added</strong>(component_or_manager) ⇒ <tt>Boolean</tt>
|
1252
|
+
|
1253
|
+
|
1254
|
+
|
1255
|
+
|
1256
|
+
|
1257
|
+
</h3><div class="docstring">
|
1258
|
+
<div class="discussion">
|
1259
|
+
|
1260
|
+
<p>Add a component or component manager so that it triggers this system when the component or a component from the component manager is added to an entity</p>
|
1261
|
+
|
1262
|
+
|
1263
|
+
</div>
|
1264
|
+
</div>
|
1265
|
+
<div class="tags">
|
1266
|
+
<p class="tag_title">Parameters:</p>
|
1267
|
+
<ul class="param">
|
1268
|
+
|
1269
|
+
<li>
|
1270
|
+
|
1271
|
+
<span class='name'>component_or_manager</span>
|
1272
|
+
|
1273
|
+
|
1274
|
+
<span class='type'>(<tt>Component or <span class='object_link'><a href="ComponentManager.html" title="FelECS::ComponentManager (class)">ComponentManager</a></span></tt>)</span>
|
1275
|
+
|
1276
|
+
|
1277
|
+
|
1278
|
+
—
|
1279
|
+
<div class='inline'>
|
1280
|
+
<p>The component or component manager to trigger this system when added</p>
|
1281
|
+
</div>
|
1282
|
+
|
1283
|
+
</li>
|
1284
|
+
|
1285
|
+
</ul>
|
1286
|
+
|
1287
|
+
<p class="tag_title">Returns:</p>
|
1288
|
+
<ul class="return">
|
1289
|
+
|
1290
|
+
<li>
|
1291
|
+
|
1292
|
+
|
1293
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1294
|
+
|
1295
|
+
|
1296
|
+
|
1297
|
+
—
|
1298
|
+
<div class='inline'>
|
1299
|
+
<p><code>true</code></p>
|
1300
|
+
</div>
|
1301
|
+
|
1302
|
+
</li>
|
1303
|
+
|
1304
|
+
</ul>
|
1305
|
+
|
1306
|
+
</div><table class="source_code">
|
1307
|
+
<tr>
|
1308
|
+
<td>
|
1309
|
+
<pre class="lines">
|
1310
|
+
|
1311
|
+
|
1312
|
+
227
|
1313
|
+
228
|
1314
|
+
229
|
1315
|
+
230
|
1316
|
+
231</pre>
|
1317
|
+
</td>
|
1318
|
+
<td>
|
1319
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 227</span>
|
1320
|
+
|
1321
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_trigger_when_added'>trigger_when_added</span><span class='lparen'>(</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rparen'>)</span>
|
1322
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_addition_triggers'>addition_triggers</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span>
|
1323
|
+
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_addition_triggers'>addition_triggers</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
|
1324
|
+
<span class='kw'>true</span>
|
1325
|
+
<span class='kw'>end</span></pre>
|
1326
|
+
</td>
|
1327
|
+
</tr>
|
1328
|
+
</table>
|
1329
|
+
</div>
|
1330
|
+
|
1331
|
+
<div class="method_details ">
|
1332
|
+
<h3 class="signature " id="trigger_when_is_changed-instance_method">
|
1333
|
+
|
1334
|
+
#<strong>trigger_when_is_changed</strong>(component_or_manager, attr) ⇒ <tt>Boolean</tt>
|
1335
|
+
|
1336
|
+
|
1337
|
+
|
1338
|
+
|
1339
|
+
|
1340
|
+
</h3><div class="docstring">
|
1341
|
+
<div class="discussion">
|
1342
|
+
|
1343
|
+
<p>Add a component or component manager so that it triggers this system when a component's attribute is changed.</p>
|
1344
|
+
|
1345
|
+
|
1346
|
+
</div>
|
1347
|
+
</div>
|
1348
|
+
<div class="tags">
|
1349
|
+
|
1350
|
+
<p class="tag_title">Returns:</p>
|
1351
|
+
<ul class="return">
|
1352
|
+
|
1353
|
+
<li>
|
1354
|
+
|
1355
|
+
|
1356
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1357
|
+
|
1358
|
+
|
1359
|
+
|
1360
|
+
—
|
1361
|
+
<div class='inline'>
|
1362
|
+
<p><code>true</code></p>
|
1363
|
+
</div>
|
1364
|
+
|
1365
|
+
</li>
|
1366
|
+
|
1367
|
+
</ul>
|
1368
|
+
|
1369
|
+
</div><table class="source_code">
|
1370
|
+
<tr>
|
1371
|
+
<td>
|
1372
|
+
<pre class="lines">
|
1373
|
+
|
1374
|
+
|
1375
|
+
244
|
1376
|
+
245
|
1377
|
+
246
|
1378
|
+
247
|
1379
|
+
248
|
1380
|
+
249
|
1381
|
+
250
|
1382
|
+
251
|
1383
|
+
252
|
1384
|
+
253
|
1385
|
+
254
|
1386
|
+
255
|
1387
|
+
256</pre>
|
1388
|
+
</td>
|
1389
|
+
<td>
|
1390
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 244</span>
|
1391
|
+
|
1392
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_trigger_when_is_changed'>trigger_when_is_changed</span><span class='lparen'>(</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='comma'>,</span> <span class='id identifier rubyid_attr'>attr</span><span class='rparen'>)</span>
|
1393
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1394
|
+
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
|
1395
|
+
<span class='kw'>else</span>
|
1396
|
+
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
|
1397
|
+
<span class='kw'>end</span>
|
1398
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1399
|
+
<span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
|
1400
|
+
<span class='kw'>else</span>
|
1401
|
+
<span class='id identifier rubyid_attr_triggers'>attr_triggers</span><span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_attr'>attr</span><span class='rbracket'>]</span>
|
1402
|
+
<span class='kw'>end</span>
|
1403
|
+
<span class='kw'>true</span>
|
1404
|
+
<span class='kw'>end</span></pre>
|
1405
|
+
</td>
|
1406
|
+
</tr>
|
1407
|
+
</table>
|
1408
|
+
</div>
|
1409
|
+
|
1410
|
+
<div class="method_details ">
|
1411
|
+
<h3 class="signature " id="trigger_when_removed-instance_method">
|
1412
|
+
|
1413
|
+
#<strong>trigger_when_removed</strong>(component_or_manager) ⇒ <tt>Boolean</tt>
|
1414
|
+
|
1415
|
+
|
1416
|
+
|
1417
|
+
|
1418
|
+
|
1419
|
+
</h3><div class="docstring">
|
1420
|
+
<div class="discussion">
|
1421
|
+
|
1422
|
+
<p>Add a component or component manager so that it triggers this system when the component or a component from the component manager is removed from an entity</p>
|
1423
|
+
|
1424
|
+
|
1425
|
+
</div>
|
1426
|
+
</div>
|
1427
|
+
<div class="tags">
|
1428
|
+
<p class="tag_title">Parameters:</p>
|
1429
|
+
<ul class="param">
|
1430
|
+
|
1431
|
+
<li>
|
1432
|
+
|
1433
|
+
<span class='name'>component_or_manager</span>
|
1434
|
+
|
1435
|
+
|
1436
|
+
<span class='type'>(<tt>Component or <span class='object_link'><a href="ComponentManager.html" title="FelECS::ComponentManager (class)">ComponentManager</a></span></tt>)</span>
|
1437
|
+
|
1438
|
+
|
1439
|
+
|
1440
|
+
—
|
1441
|
+
<div class='inline'>
|
1442
|
+
<p>The component or component manager to trigger this system when removed</p>
|
1443
|
+
</div>
|
1444
|
+
|
1445
|
+
</li>
|
1446
|
+
|
1447
|
+
</ul>
|
1448
|
+
|
1449
|
+
<p class="tag_title">Returns:</p>
|
1450
|
+
<ul class="return">
|
1451
|
+
|
1452
|
+
<li>
|
1453
|
+
|
1454
|
+
|
1455
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1456
|
+
|
1457
|
+
|
1458
|
+
|
1459
|
+
—
|
1460
|
+
<div class='inline'>
|
1461
|
+
<p><code>true</code></p>
|
1462
|
+
</div>
|
1463
|
+
|
1464
|
+
</li>
|
1465
|
+
|
1466
|
+
</ul>
|
1467
|
+
|
1468
|
+
</div><table class="source_code">
|
1469
|
+
<tr>
|
1470
|
+
<td>
|
1471
|
+
<pre class="lines">
|
1472
|
+
|
1473
|
+
|
1474
|
+
236
|
1475
|
+
237
|
1476
|
+
238
|
1477
|
+
239
|
1478
|
+
240</pre>
|
1479
|
+
</td>
|
1480
|
+
<td>
|
1481
|
+
<pre class="code"><span class="info file"># File 'lib/felecs/system_manager.rb', line 236</span>
|
1482
|
+
|
1483
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_trigger_when_removed'>trigger_when_removed</span><span class='lparen'>(</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rparen'>)</span>
|
1484
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_removal_triggers'>removal_triggers</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='rbracket'>]</span>
|
1485
|
+
<span class='id identifier rubyid_component_or_manager'>component_or_manager</span><span class='period'>.</span><span class='id identifier rubyid_removal_triggers'>removal_triggers</span> <span class='op'>|=</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
|
1486
|
+
<span class='kw'>true</span>
|
1487
|
+
<span class='kw'>end</span></pre>
|
1488
|
+
</td>
|
1489
|
+
</tr>
|
1490
|
+
</table>
|
1491
|
+
</div>
|
1492
|
+
|
1493
|
+
</div>
|
1494
|
+
|
1495
|
+
</div>
|
1496
|
+
|
1497
|
+
<div id="footer">
|
1498
|
+
Generated on Wed Feb 2 03:29:07 2022 by
|
1499
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1500
|
+
0.9.26 (ruby-2.7.3).
|
1501
|
+
</div>
|
1502
|
+
|
1503
|
+
</div>
|
1504
|
+
</body>
|
1505
|
+
</html>
|