zyps 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.txt +0 -14
- data/bin/zyps +240 -28
- data/bin/zyps_demo +18 -2
- data/doc/classes/Behavior.html +205 -0
- data/doc/classes/Behavior.src/M000003.html +18 -0
- data/doc/classes/Behavior.src/M000004.html +19 -0
- data/doc/classes/Clock.html +165 -0
- data/doc/classes/Clock.src/M000026.html +18 -0
- data/doc/classes/Clock.src/M000027.html +21 -0
- data/doc/classes/Color.html +299 -0
- data/doc/classes/Color.src/M000015.html +18 -0
- data/doc/classes/Color.src/M000016.html +16 -0
- data/doc/classes/Color.src/M000017.html +16 -0
- data/doc/classes/Color.src/M000018.html +16 -0
- data/doc/classes/Color.src/M000019.html +18 -0
- data/doc/classes/Color.src/M000020.html +22 -0
- data/doc/classes/Creature.html +176 -0
- data/doc/classes/Creature.src/M000005.html +19 -0
- data/doc/classes/Environment.html +203 -0
- data/doc/classes/Environment.src/M000028.html +19 -0
- data/doc/classes/Environment.src/M000029.html +45 -0
- data/doc/classes/EnvironmentalFactor.html +167 -0
- data/doc/classes/EnvironmentalFactor.src/M000021.html +18 -0
- data/doc/classes/GameObject.html +256 -0
- data/doc/classes/GameObject.src/M000022.html +20 -0
- data/doc/classes/GameObject.src/M000023.html +19 -0
- data/doc/classes/GameObject.src/M000024.html +16 -0
- data/doc/classes/GameObject.src/M000025.html +16 -0
- data/doc/classes/Location.html +167 -0
- data/doc/classes/Location.src/M000014.html +18 -0
- data/doc/classes/Responsive.html +143 -0
- data/doc/classes/Responsive.src/M000030.html +18 -0
- data/doc/classes/TrailsView.html +217 -0
- data/doc/classes/TrailsView.src/M000001.html +40 -0
- data/doc/classes/TrailsView.src/M000002.html +76 -0
- data/doc/classes/Utility.html +264 -0
- data/doc/classes/Utility.src/M000031.html +26 -0
- data/doc/classes/Utility.src/M000032.html +22 -0
- data/doc/classes/Utility.src/M000033.html +18 -0
- data/doc/classes/Utility.src/M000034.html +21 -0
- data/doc/classes/Utility.src/M000035.html +25 -0
- data/doc/classes/Utility.src/M000036.html +21 -0
- data/doc/classes/Utility.src/M000037.html +22 -0
- data/doc/classes/Vector.html +281 -0
- data/doc/classes/Vector.src/M000006.html +19 -0
- data/doc/classes/Vector.src/M000007.html +16 -0
- data/doc/classes/Vector.src/M000008.html +21 -0
- data/doc/classes/Vector.src/M000009.html +16 -0
- data/doc/classes/Vector.src/M000010.html +18 -0
- data/doc/classes/Vector.src/M000011.html +16 -0
- data/doc/classes/Vector.src/M000012.html +18 -0
- data/doc/classes/Vector.src/M000013.html +25 -0
- data/doc/created.rid +1 -0
- data/doc/files/COPYING_LESSER_txt.html +311 -0
- data/doc/files/COPYING_txt.html +1003 -0
- data/doc/files/README_txt.html +214 -0
- data/doc/files/lib/zyps/views/trails_rb.html +134 -0
- data/doc/files/lib/zyps_rb.html +134 -0
- data/doc/fr_class_index.html +38 -0
- data/doc/fr_file_index.html +31 -0
- data/doc/fr_method_index.html +63 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/zyps/views/trails.rb +3 -3
- metadata +81 -6
- data/bin/zyps_server +0 -178
@@ -0,0 +1,176 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Creature</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Creature</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/zyps_rb.html">
|
59
|
+
lib/zyps.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="GameObject.html">
|
69
|
+
GameObject
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
A <a href="Creature.html">Creature</a> is a <a
|
86
|
+
href="GameObject.html">GameObject</a> that can sense and respond to other
|
87
|
+
GameObjects (including other <a href="Creature.html">Creature</a> objects).
|
88
|
+
</p>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div id="method-list">
|
96
|
+
<h3 class="section-bar">Methods</h3>
|
97
|
+
|
98
|
+
<div class="name-list">
|
99
|
+
<a href="#M000005">new</a>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
<!-- if includes -->
|
107
|
+
<div id="includes">
|
108
|
+
<h3 class="section-bar">Included Modules</h3>
|
109
|
+
|
110
|
+
<div id="includes-list">
|
111
|
+
<span class="include-name"><a href="Responsive.html">Responsive</a></span>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div id="section">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div id="attribute-list">
|
122
|
+
<h3 class="section-bar">Attributes</h3>
|
123
|
+
|
124
|
+
<div class="name-list">
|
125
|
+
<table>
|
126
|
+
<tr class="top-aligned-row context-row">
|
127
|
+
<td class="context-item-name">behaviors</td>
|
128
|
+
<td class="context-item-value"> [RW] </td>
|
129
|
+
<td class="context-item-desc">
|
130
|
+
A list of <a href="Behavior.html">Behavior</a> objects that determine the
|
131
|
+
creature‘s response to its environment.
|
132
|
+
|
133
|
+
</td>
|
134
|
+
</tr>
|
135
|
+
</table>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<!-- if method_list -->
|
142
|
+
<div id="methods">
|
143
|
+
<h3 class="section-bar">Public Class methods</h3>
|
144
|
+
|
145
|
+
<div id="method-M000005" class="method-detail">
|
146
|
+
<a name="M000005"></a>
|
147
|
+
|
148
|
+
<div class="method-heading">
|
149
|
+
<a href="Creature.src/M000005.html" target="Code" class="method-signature"
|
150
|
+
onclick="popupCode('Creature.src/M000005.html');return false;">
|
151
|
+
<span class="method-name">new</span><span class="method-args">(name = nil, location = Location.new, color = Color.new, vector = Vector.new, age = 0, tags = [], behaviors = [])</span>
|
152
|
+
</a>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div class="method-description">
|
156
|
+
<p>
|
157
|
+
Identical to the <a href="GameObject.html">GameObject</a> constructor,
|
158
|
+
except that it also takes a list of <a href="Behavior.html">Behavior</a>
|
159
|
+
objects.
|
160
|
+
</p>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
|
170
|
+
|
171
|
+
<div id="validator-badges">
|
172
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
</body>
|
176
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (Creature)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 134</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> (<span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">location</span> = <span class="ruby-constant">Location</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">color</span> = <span class="ruby-constant">Color</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">vector</span> = <span class="ruby-constant">Vector</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">age</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">tags</span> = [], <span class="ruby-identifier">behaviors</span> = [])
|
15
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">location</span>, <span class="ruby-identifier">color</span>, <span class="ruby-identifier">vector</span>, <span class="ruby-identifier">age</span>, <span class="ruby-identifier">tags</span>)
|
16
|
+
<span class="ruby-ivar">@behaviors</span> = <span class="ruby-identifier">behaviors</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,203 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Environment</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Environment</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/zyps_rb.html">
|
59
|
+
lib/zyps.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
A virtual environment.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000029">interact</a>
|
96
|
+
<a href="#M000028">new</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if includes -->
|
104
|
+
<div id="includes">
|
105
|
+
<h3 class="section-bar">Included Modules</h3>
|
106
|
+
|
107
|
+
<div id="includes-list">
|
108
|
+
<span class="include-name">Observable</span>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<div id="section">
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<div id="attribute-list">
|
119
|
+
<h3 class="section-bar">Attributes</h3>
|
120
|
+
|
121
|
+
<div class="name-list">
|
122
|
+
<table>
|
123
|
+
<tr class="top-aligned-row context-row">
|
124
|
+
<td class="context-item-name">environmental_factors</td>
|
125
|
+
<td class="context-item-value"> [RW] </td>
|
126
|
+
<td class="context-item-desc">
|
127
|
+
An array of <a href="EnvironmentalFactor.html">EnvironmentalFactor</a>
|
128
|
+
objects that act on any <a href="GameObject.html">GameObject</a> in the <a
|
129
|
+
href="Environment.html">Environment</a>.
|
130
|
+
|
131
|
+
</td>
|
132
|
+
</tr>
|
133
|
+
<tr class="top-aligned-row context-row">
|
134
|
+
<td class="context-item-name">objects</td>
|
135
|
+
<td class="context-item-value"> [RW] </td>
|
136
|
+
<td class="context-item-desc">
|
137
|
+
An array of <a href="GameObject.html">GameObject</a> objects that reside in
|
138
|
+
the <a href="Environment.html">Environment</a>.
|
139
|
+
|
140
|
+
</td>
|
141
|
+
</tr>
|
142
|
+
</table>
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<!-- if method_list -->
|
149
|
+
<div id="methods">
|
150
|
+
<h3 class="section-bar">Public Class methods</h3>
|
151
|
+
|
152
|
+
<div id="method-M000028" class="method-detail">
|
153
|
+
<a name="M000028"></a>
|
154
|
+
|
155
|
+
<div class="method-heading">
|
156
|
+
<a href="Environment.src/M000028.html" target="Code" class="method-signature"
|
157
|
+
onclick="popupCode('Environment.src/M000028.html');return false;">
|
158
|
+
<span class="method-name">new</span><span class="method-args">(objects = [], environmental_factors = [])</span>
|
159
|
+
</a>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
167
|
+
|
168
|
+
<div id="method-M000029" class="method-detail">
|
169
|
+
<a name="M000029"></a>
|
170
|
+
|
171
|
+
<div class="method-heading">
|
172
|
+
<a href="Environment.src/M000029.html" target="Code" class="method-signature"
|
173
|
+
onclick="popupCode('Environment.src/M000029.html');return false;">
|
174
|
+
<span class="method-name">interact</span><span class="method-args">()</span>
|
175
|
+
</a>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div class="method-description">
|
179
|
+
<p>
|
180
|
+
Allow everything in the environment to <a
|
181
|
+
href="Environment.html#M000029">interact</a> with each other. Objects are
|
182
|
+
first moved according to their preexisting vectors and the amount of time
|
183
|
+
since the last call. Then each <a
|
184
|
+
href="EnvironmentalFactor.html">EnvironmentalFactor</a> is allowed to act
|
185
|
+
on each object. Finally, each <a href="GameObject.html">GameObject</a> with
|
186
|
+
an act() method is allowed to act on every other object.
|
187
|
+
</p>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
</div>
|
193
|
+
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
|
198
|
+
<div id="validator-badges">
|
199
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
</body>
|
203
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (Environment)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 32</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> (<span class="ruby-identifier">objects</span> = [], <span class="ruby-identifier">environmental_factors</span> = [])
|
15
|
+
<span class="ruby-ivar">@objects</span>, <span class="ruby-ivar">@environmental_factors</span> = <span class="ruby-identifier">objects</span>, <span class="ruby-identifier">environmental_factors</span>
|
16
|
+
<span class="ruby-ivar">@clock</span> = <span class="ruby-constant">Clock</span>.<span class="ruby-identifier">new</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>interact (Environment)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 41</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">interact</span>
|
15
|
+
|
16
|
+
<span class="ruby-comment cmt">#Get time since last interaction.</span>
|
17
|
+
<span class="ruby-identifier">elapsed_time</span> = <span class="ruby-ivar">@clock</span>.<span class="ruby-identifier">elapsed_time</span>
|
18
|
+
|
19
|
+
<span class="ruby-identifier">objects</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">object</span><span class="ruby-operator">|</span>
|
20
|
+
|
21
|
+
<span class="ruby-comment cmt">#Move each object according to its vector.</span>
|
22
|
+
<span class="ruby-identifier">object</span>.<span class="ruby-identifier">move</span>(<span class="ruby-identifier">elapsed_time</span>)
|
23
|
+
|
24
|
+
<span class="ruby-comment cmt">#Have all environmental factors interact with each object.</span>
|
25
|
+
<span class="ruby-identifier">environmental_factors</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">factor</span><span class="ruby-operator">|</span> <span class="ruby-identifier">factor</span>.<span class="ruby-identifier">act</span>(<span class="ruby-identifier">object</span>)}
|
26
|
+
|
27
|
+
<span class="ruby-comment cmt">#Have all creatures interact with each other.</span>
|
28
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:act</span>)
|
29
|
+
<span class="ruby-identifier">objects</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">target</span><span class="ruby-operator">|</span>
|
30
|
+
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">object</span>) <span class="ruby-comment cmt">#Ensure object does not act on itself.</span>
|
31
|
+
<span class="ruby-identifier">object</span>.<span class="ruby-identifier">act</span>(<span class="ruby-identifier">target</span>)
|
32
|
+
<span class="ruby-keyword kw">end</span>
|
33
|
+
<span class="ruby-keyword kw">end</span>
|
34
|
+
|
35
|
+
<span class="ruby-keyword kw">end</span>
|
36
|
+
|
37
|
+
<span class="ruby-comment cmt">#Mark environment as changed.</span>
|
38
|
+
<span class="ruby-identifier">changed</span>
|
39
|
+
|
40
|
+
<span class="ruby-comment cmt">#Alert observers.</span>
|
41
|
+
<span class="ruby-identifier">notify_observers</span>(<span class="ruby-keyword kw">self</span>)
|
42
|
+
|
43
|
+
<span class="ruby-keyword kw">end</span></pre>
|
44
|
+
</body>
|
45
|
+
</html>
|
@@ -0,0 +1,167 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: EnvironmentalFactor</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">EnvironmentalFactor</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/zyps_rb.html">
|
59
|
+
lib/zyps.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Something in the environment that acts on creatures.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000021">new</a>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if includes -->
|
103
|
+
<div id="includes">
|
104
|
+
<h3 class="section-bar">Included Modules</h3>
|
105
|
+
|
106
|
+
<div id="includes-list">
|
107
|
+
<span class="include-name"><a href="Responsive.html">Responsive</a></span>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div id="section">
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<div id="attribute-list">
|
118
|
+
<h3 class="section-bar">Attributes</h3>
|
119
|
+
|
120
|
+
<div class="name-list">
|
121
|
+
<table>
|
122
|
+
<tr class="top-aligned-row context-row">
|
123
|
+
<td class="context-item-name">behaviors</td>
|
124
|
+
<td class="context-item-value"> [RW] </td>
|
125
|
+
<td class="context-item-desc">
|
126
|
+
A list of <a href="Behavior.html">Behavior</a> objects, each called in the
|
127
|
+
same way as those of a <a href="Creature.html">Creature</a>.
|
128
|
+
|
129
|
+
</td>
|
130
|
+
</tr>
|
131
|
+
</table>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<!-- if method_list -->
|
138
|
+
<div id="methods">
|
139
|
+
<h3 class="section-bar">Public Class methods</h3>
|
140
|
+
|
141
|
+
<div id="method-M000021" class="method-detail">
|
142
|
+
<a name="M000021"></a>
|
143
|
+
|
144
|
+
<div class="method-heading">
|
145
|
+
<a href="EnvironmentalFactor.src/M000021.html" target="Code" class="method-signature"
|
146
|
+
onclick="popupCode('EnvironmentalFactor.src/M000021.html');return false;">
|
147
|
+
<span class="method-name">new</span><span class="method-args">(behaviors = [])</span>
|
148
|
+
</a>
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div class="method-description">
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
<div id="validator-badges">
|
163
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
</body>
|
167
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (EnvironmentalFactor)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/zyps.rb, line 151</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> (<span class="ruby-identifier">behaviors</span> = [])
|
15
|
+
<span class="ruby-ivar">@behaviors</span> = <span class="ruby-identifier">behaviors</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|