zyps 0.4.1 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/zyps +32 -80
- data/lib/zyps/actions.rb +74 -2
- data/lib/zyps/environmental_factors.rb +16 -0
- data/lib/zyps.rb +90 -17
- data/test/test_zyps.rb +111 -8
- data/test/zyps/test_actions.rb +111 -46
- data/test/zyps/test_behaviors.rb +0 -0
- data/test/zyps/test_environmental_factors.rb +33 -0
- metadata +3 -134
- data/doc/classes/AccelerateAction.html +0 -182
- data/doc/classes/AccelerateAction.src/M000009.html +0 -19
- data/doc/classes/AccelerateAction.src/M000010.html +0 -18
- data/doc/classes/Action.html +0 -118
- data/doc/classes/AgeCondition.html +0 -181
- data/doc/classes/AgeCondition.src/M000039.html +0 -18
- data/doc/classes/AgeCondition.src/M000040.html +0 -18
- data/doc/classes/ApproachAction.html +0 -189
- data/doc/classes/ApproachAction.src/M000048.html +0 -19
- data/doc/classes/ApproachAction.src/M000049.html +0 -38
- data/doc/classes/Behavior.html +0 -202
- data/doc/classes/Behavior.src/M000001.html +0 -18
- data/doc/classes/Behavior.src/M000002.html +0 -19
- data/doc/classes/BlendAction.html +0 -181
- data/doc/classes/BlendAction.src/M000043.html +0 -18
- data/doc/classes/BlendAction.src/M000044.html +0 -18
- data/doc/classes/Clock.html +0 -165
- data/doc/classes/Clock.src/M000041.html +0 -18
- data/doc/classes/Clock.src/M000042.html +0 -21
- data/doc/classes/CollisionCondition.html +0 -148
- data/doc/classes/CollisionCondition.src/M000053.html +0 -18
- data/doc/classes/Color.html +0 -299
- data/doc/classes/Color.src/M000022.html +0 -18
- data/doc/classes/Color.src/M000023.html +0 -16
- data/doc/classes/Color.src/M000024.html +0 -16
- data/doc/classes/Color.src/M000025.html +0 -16
- data/doc/classes/Color.src/M000026.html +0 -18
- data/doc/classes/Color.src/M000027.html +0 -22
- data/doc/classes/Condition.html +0 -118
- data/doc/classes/Creature.html +0 -191
- data/doc/classes/Creature.src/M000011.html +0 -19
- data/doc/classes/Creature.src/M000012.html +0 -18
- data/doc/classes/DestroyAction.html +0 -181
- data/doc/classes/DestroyAction.src/M000030.html +0 -18
- data/doc/classes/DestroyAction.src/M000031.html +0 -18
- data/doc/classes/EatAction.html +0 -149
- data/doc/classes/EatAction.src/M000045.html +0 -21
- data/doc/classes/Enclosure.html +0 -206
- data/doc/classes/Enclosure.src/M000005.html +0 -18
- data/doc/classes/Enclosure.src/M000006.html +0 -31
- data/doc/classes/Environment.html +0 -203
- data/doc/classes/Environment.src/M000046.html +0 -19
- data/doc/classes/Environment.src/M000047.html +0 -45
- data/doc/classes/EnvironmentalFactor.html +0 -118
- data/doc/classes/FaceAction.html +0 -148
- data/doc/classes/FaceAction.src/M000052.html +0 -18
- data/doc/classes/FleeAction.html +0 -189
- data/doc/classes/FleeAction.src/M000054.html +0 -19
- data/doc/classes/FleeAction.src/M000055.html +0 -38
- data/doc/classes/GameObject.html +0 -282
- data/doc/classes/GameObject.src/M000032.html +0 -19
- data/doc/classes/GameObject.src/M000033.html +0 -16
- data/doc/classes/GameObject.src/M000034.html +0 -19
- data/doc/classes/GameObject.src/M000035.html +0 -16
- data/doc/classes/GameObject.src/M000036.html +0 -16
- data/doc/classes/Location.html +0 -167
- data/doc/classes/Location.src/M000021.html +0 -18
- data/doc/classes/ProximityCondition.html +0 -182
- data/doc/classes/ProximityCondition.src/M000037.html +0 -18
- data/doc/classes/ProximityCondition.src/M000038.html +0 -18
- data/doc/classes/TagAction.html +0 -181
- data/doc/classes/TagAction.src/M000028.html +0 -18
- data/doc/classes/TagAction.src/M000029.html +0 -18
- data/doc/classes/TagCondition.html +0 -181
- data/doc/classes/TagCondition.src/M000007.html +0 -18
- data/doc/classes/TagCondition.src/M000008.html +0 -18
- data/doc/classes/TrailsView.html +0 -209
- data/doc/classes/TrailsView.src/M000003.html +0 -40
- data/doc/classes/TrailsView.src/M000004.html +0 -78
- data/doc/classes/TurnAction.html +0 -182
- data/doc/classes/TurnAction.src/M000050.html +0 -19
- data/doc/classes/TurnAction.src/M000051.html +0 -18
- data/doc/classes/Utility.html +0 -264
- data/doc/classes/Utility.src/M000056.html +0 -26
- data/doc/classes/Utility.src/M000057.html +0 -22
- data/doc/classes/Utility.src/M000058.html +0 -18
- data/doc/classes/Utility.src/M000059.html +0 -21
- data/doc/classes/Utility.src/M000060.html +0 -25
- data/doc/classes/Utility.src/M000061.html +0 -21
- data/doc/classes/Utility.src/M000062.html +0 -21
- data/doc/classes/Vector.html +0 -281
- data/doc/classes/Vector.src/M000013.html +0 -19
- data/doc/classes/Vector.src/M000014.html +0 -16
- data/doc/classes/Vector.src/M000015.html +0 -21
- data/doc/classes/Vector.src/M000016.html +0 -16
- data/doc/classes/Vector.src/M000017.html +0 -18
- data/doc/classes/Vector.src/M000018.html +0 -16
- data/doc/classes/Vector.src/M000019.html +0 -18
- data/doc/classes/Vector.src/M000020.html +0 -25
- data/doc/created.rid +0 -1
- data/doc/files/COPYING_LESSER_txt.html +0 -311
- data/doc/files/COPYING_txt.html +0 -1003
- data/doc/files/README_txt.html +0 -214
- data/doc/files/lib/zyps/actions_rb.html +0 -134
- data/doc/files/lib/zyps/conditions_rb.html +0 -134
- data/doc/files/lib/zyps/environmental_factors_rb.html +0 -134
- data/doc/files/lib/zyps/views/trails_rb.html +0 -134
- data/doc/files/lib/zyps_rb.html +0 -134
- data/doc/fr_class_index.html +0 -53
- data/doc/fr_file_index.html +0 -34
- data/doc/fr_method_index.html +0 -88
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
data/test/zyps/test_actions.rb
CHANGED
@@ -30,154 +30,219 @@ end
|
|
30
30
|
class TestActions < Test::Unit::TestCase
|
31
31
|
|
32
32
|
|
33
|
+
#Create and populate an environment.
|
33
34
|
def setup
|
34
35
|
@actor = Creature.new('name', Location.new(0, 0))
|
35
|
-
@
|
36
|
+
@target1 = GameObject.new('name', Location.new(1, 1))
|
37
|
+
@target2 = GameObject.new('name', Location.new(-2, -2))
|
38
|
+
#Create an environment, and add the objects.
|
39
|
+
@environment = Environment.new
|
40
|
+
#Order is important - we want to act on target 1 first.
|
41
|
+
@environment.objects << @actor << @target1 << @target2
|
42
|
+
end
|
43
|
+
|
44
|
+
#Add a new behavior to a creature with the given action.
|
45
|
+
def add_action(action, creature)
|
46
|
+
behavior = Behavior.new
|
47
|
+
behavior.actions << action
|
48
|
+
creature.behaviors << behavior
|
36
49
|
end
|
37
50
|
|
38
51
|
|
52
|
+
#A FaceAction turns directly toward the target.
|
39
53
|
def test_face_action
|
40
|
-
FaceAction.new
|
54
|
+
add_action(FaceAction.new, @actor)
|
55
|
+
@environment.interact
|
41
56
|
assert_equal(45, @actor.vector.pitch)
|
42
57
|
end
|
43
58
|
|
44
59
|
|
60
|
+
#An AccelerateAction speeds up the actor at a given rate.
|
45
61
|
def test_accelerate_action
|
46
62
|
#Accelerate 1 unit per second.
|
47
|
-
AccelerateAction.new(1)
|
63
|
+
add_action(AccelerateAction.new(1), @actor)
|
64
|
+
@environment.interact
|
48
65
|
#Clock always returns 0.1 seconds, so actor should be moving 0.1 unit/second faster.
|
49
66
|
assert_equal(0.1, @actor.vector.speed)
|
50
67
|
end
|
51
68
|
|
52
69
|
|
70
|
+
#A TurnAction turns the actor at a given rate.
|
53
71
|
def test_turn_action
|
54
72
|
#Turn 1 degree per second.
|
55
|
-
TurnAction.new(1)
|
73
|
+
add_action(TurnAction.new(1), @actor)
|
74
|
+
@environment.interact
|
56
75
|
#Clock always returns 0.1 seconds, so actor should be turned 0.1 degrees.
|
57
76
|
assert_equal(0.1, @actor.vector.pitch)
|
58
77
|
end
|
59
78
|
|
60
79
|
|
80
|
+
#An ApproachAction pushes the actor toward the target.
|
61
81
|
def test_approach_action
|
62
82
|
|
63
83
|
#Create an ApproachAction with a 0-degree vector, turn rate of 40 degrees/sec.
|
64
|
-
@actor.vector = Vector.new(
|
84
|
+
@actor.vector = Vector.new(0, 0)
|
65
85
|
action = ApproachAction.new(Vector.new(1, 0), 40)
|
86
|
+
add_action(action, @actor)
|
66
87
|
#Act.
|
67
|
-
|
88
|
+
@environment.interact
|
68
89
|
#Ensure action's thrust vector is correct for 0.1 seconds.
|
69
90
|
assert_equal(1.0, action.heading.speed)
|
70
91
|
assert_equal(4.0, action.heading.pitch)
|
71
92
|
#Ensure actor's resulting vector is correct.
|
72
|
-
assert_in_delta(
|
93
|
+
assert_in_delta(0.997, @actor.vector.x, 0.001)
|
73
94
|
assert_in_delta(0.069, @actor.vector.y, 0.001)
|
74
|
-
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
#Ensure ApproachAction doesn't oversteer.
|
99
|
+
def test_approach_action_accuracy
|
100
|
+
|
75
101
|
#Create an ApproachAction with a 0-degree vector, turn rate high enough to turn more than 45 degrees in 0.1 seconds.
|
76
102
|
#Action should only turn as far as target.
|
77
|
-
@actor.vector = Vector.new(
|
103
|
+
@actor.vector = Vector.new(0, 0)
|
78
104
|
action = ApproachAction.new(Vector.new(1, 0), 500)
|
105
|
+
add_action(action, @actor)
|
79
106
|
#Act.
|
80
|
-
|
107
|
+
@environment.interact
|
108
|
+
|
81
109
|
#Ensure actor is approaching target directly.
|
82
110
|
assert_equal(1.0, action.heading.speed)
|
83
111
|
assert_equal(45, action.heading.pitch)
|
84
112
|
#Ensure actor's resulting vector is correct.
|
85
|
-
assert_in_delta(
|
113
|
+
assert_in_delta(0.707, @actor.vector.x, 0.001)
|
86
114
|
assert_in_delta(0.707, @actor.vector.y, 0.001)
|
87
115
|
|
88
116
|
end
|
89
117
|
|
90
118
|
|
119
|
+
#A FleeAction pushes the actor away from a target.
|
91
120
|
def test_flee_action
|
92
121
|
|
93
122
|
#Create a FleeAction with a 0-degree vector, turn rate of 40 degrees/sec.
|
94
|
-
@actor.vector = Vector.new(
|
123
|
+
@actor.vector = Vector.new(0, 0)
|
95
124
|
action = FleeAction.new(Vector.new(1, 0), 40)
|
125
|
+
add_action(action, @actor)
|
96
126
|
#Act.
|
97
|
-
|
127
|
+
@environment.interact
|
98
128
|
#Ensure action's thrust vector is correct for 0.1 seconds.
|
99
129
|
assert_equal(1.0, action.heading.speed)
|
100
130
|
assert_equal(356.0, action.heading.pitch) #Should be heading away.
|
101
131
|
#Ensure actor's resulting vector is correct.
|
102
|
-
assert_in_delta(
|
132
|
+
assert_in_delta(0.997, @actor.vector.x, 0.001)
|
103
133
|
assert_in_delta(-0.069, @actor.vector.y, 0.001)
|
104
|
-
|
134
|
+
end
|
135
|
+
|
136
|
+
#Ensure flee action doesn't oversteer.
|
137
|
+
def test_flee_action_accuracy
|
138
|
+
|
105
139
|
#Create a FleeAction with a 0-degree vector, turn rate high enough to turn more than 135 degrees in 0.1 seconds.
|
106
140
|
#Action should turn directly away from target, but no farther.
|
107
|
-
@actor.vector = Vector.new(
|
141
|
+
@actor.vector = Vector.new(0, 0)
|
108
142
|
action = FleeAction.new(Vector.new(1, 0), 1400)
|
143
|
+
add_action(action, @actor)
|
109
144
|
#Act.
|
110
|
-
|
145
|
+
@environment.interact
|
111
146
|
#Ensure actor is fleeing directly away from target.
|
112
147
|
assert_equal(1.0, action.heading.speed)
|
113
148
|
assert_equal(225, action.heading.pitch)
|
114
149
|
#Ensure actor's resulting vector is correct.
|
115
|
-
assert_in_delta(0.
|
150
|
+
assert_in_delta(-0.707, @actor.vector.x, 0.001)
|
116
151
|
assert_in_delta(-0.707, @actor.vector.y, 0.001)
|
117
152
|
|
118
153
|
end
|
119
154
|
|
120
155
|
|
156
|
+
#A DestroyAction removes the target from the environment.
|
121
157
|
def test_destroy_action
|
122
|
-
#Create an environment, and add the objects.
|
123
|
-
environment = Environment.new
|
124
|
-
environment.objects << @actor << @target
|
125
158
|
#Create a DestroyAction, linked to the environment.
|
126
|
-
|
159
|
+
add_action(DestroyAction.new(@environment), @actor)
|
127
160
|
#Act.
|
128
|
-
|
161
|
+
@environment.interact
|
129
162
|
#Verify target is removed from environment.
|
130
|
-
assert(! environment.objects.include?(@
|
163
|
+
assert(! @environment.objects.include?(@target1))
|
164
|
+
#Verify non-target is removed from environment.
|
165
|
+
assert(@environment.objects.include?(@target2))
|
166
|
+
#Act again.
|
167
|
+
@environment.interact
|
168
|
+
#Verify targets were switched.
|
169
|
+
assert(! @environment.objects.include?(@target2), "Targets should have been switched.")
|
131
170
|
end
|
132
171
|
|
133
172
|
|
173
|
+
#An EatAction is like a DestroyAction, but also makes the actor grow in size.
|
134
174
|
def test_eat_action
|
135
|
-
#Create an environment, and add the objects.
|
136
|
-
environment = Environment.new
|
137
|
-
environment.objects << @actor << @target
|
138
175
|
#Create an EatAction, linked to the environment.
|
139
|
-
|
176
|
+
add_action(EatAction.new(@environment), @actor)
|
140
177
|
#Act.
|
141
178
|
@actor.size = 1
|
142
|
-
@
|
143
|
-
|
179
|
+
@target1.size = 1
|
180
|
+
@environment.interact
|
144
181
|
#Verify target is removed from environment.
|
145
|
-
assert(! environment.objects.include?(@
|
182
|
+
assert(! @environment.objects.include?(@target1))
|
146
183
|
#Verify creature has grown by the appropriate amount.
|
147
184
|
assert_equal(2, @actor.size)
|
148
185
|
end
|
149
186
|
|
150
187
|
|
188
|
+
#A TagAction adds a tag to the target.
|
151
189
|
def test_tag_action
|
152
190
|
#Create a TagAction, and act.
|
153
|
-
TagAction.new("tag")
|
191
|
+
add_action(TagAction.new("tag"), @actor)
|
192
|
+
@environment.interact
|
154
193
|
#Verify target has appropriate tag.
|
155
|
-
assert(@
|
194
|
+
assert(@target1.tags.include?("tag"))
|
156
195
|
end
|
157
196
|
|
158
197
|
|
159
|
-
|
198
|
+
#A BlendAction shifts the target's color toward the given color.
|
199
|
+
def test_blend_action_black
|
160
200
|
#Create a BlendAction that blends to black.
|
161
|
-
|
201
|
+
add_action(BlendAction.new(Color.new(0, 0, 0)), @actor)
|
162
202
|
#Set the target's color.
|
163
|
-
@
|
203
|
+
@target1.color = Color.new(0.5, 0.5, 0.5)
|
164
204
|
#Act.
|
165
|
-
|
205
|
+
@environment.interact
|
166
206
|
#Verify the target's new color.
|
167
|
-
assert_equal(0.25, @
|
168
|
-
assert_equal(0.25, @
|
169
|
-
assert_equal(0.25, @
|
207
|
+
assert_equal(0.25, @target1.color.red)
|
208
|
+
assert_equal(0.25, @target1.color.green)
|
209
|
+
assert_equal(0.25, @target1.color.blue)
|
210
|
+
end
|
211
|
+
|
212
|
+
#Test shifting colors toward white.
|
213
|
+
def test_blend_action_white
|
170
214
|
#Create a BlendAction that blends to white.
|
171
|
-
|
215
|
+
add_action(BlendAction.new(Color.new(1, 1, 1)), @actor)
|
172
216
|
#Set the target's color.
|
173
|
-
@
|
217
|
+
@target1.color = Color.new(0.5, 0.5, 0.5)
|
174
218
|
#Act.
|
175
|
-
|
219
|
+
@environment.interact
|
176
220
|
#Verify the target's new color.
|
177
|
-
assert_equal(0.75, @
|
178
|
-
assert_equal(0.75, @
|
179
|
-
assert_equal(0.75, @
|
221
|
+
assert_equal(0.75, @target1.color.red)
|
222
|
+
assert_equal(0.75, @target1.color.green)
|
223
|
+
assert_equal(0.75, @target1.color.blue)
|
180
224
|
end
|
181
225
|
|
182
226
|
|
227
|
+
#A PushAction pushes the target away.
|
228
|
+
def test_push_action
|
229
|
+
#Create a PushAction, and act.
|
230
|
+
add_action(PushAction.new(1), @actor)
|
231
|
+
@environment.interact
|
232
|
+
#Verify target's speed and direction are correct.
|
233
|
+
assert_equal(0.1, @target1.vector.speed, "@target1 should have been pushed away from @actor.")
|
234
|
+
assert_equal(45.0, @target1.vector.pitch, "@target1's angle should be facing away from @actor.")
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
#A PullAction pulls the target toward the actor.
|
239
|
+
def test_pull_action
|
240
|
+
#Create a PullAction, and act.
|
241
|
+
add_action(PullAction.new(1), @actor)
|
242
|
+
@environment.interact
|
243
|
+
#Verify target's speed and direction are correct.
|
244
|
+
assert_equal(0.1, @target1.vector.speed, "@target1 should have been pulled toward @actor.")
|
245
|
+
assert_equal(225.0, @target1.vector.pitch, "@target1's angle should be facing toward @actor.")
|
246
|
+
end
|
247
|
+
|
183
248
|
end
|
File without changes
|
@@ -86,3 +86,36 @@ end
|
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
+
class TestSpeedLimit < Test::Unit::TestCase
|
90
|
+
|
91
|
+
|
92
|
+
def test_speed_limit
|
93
|
+
|
94
|
+
creature = Creature.new
|
95
|
+
|
96
|
+
#Create a speed limit.
|
97
|
+
limit = SpeedLimit.new(10)
|
98
|
+
|
99
|
+
#Act on a creature going under the limit, and ensure it's unaffected.
|
100
|
+
creature.vector.speed = 1
|
101
|
+
limit.act(creature)
|
102
|
+
assert_equal(1, creature.vector.speed)
|
103
|
+
|
104
|
+
#Act on a creature going over the limit, and ensure its speed is reduced.
|
105
|
+
creature.vector.speed = 11
|
106
|
+
limit.act(creature)
|
107
|
+
assert_equal(10, creature.vector.speed)
|
108
|
+
|
109
|
+
#Act on a creature going in reverse, and ensure its speed is reduced.
|
110
|
+
creature.vector.speed = -11
|
111
|
+
limit.act(creature)
|
112
|
+
assert_equal(-10, creature.vector.speed)
|
113
|
+
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: zyps
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.5.1
|
7
|
+
date: 2007-09-23 00:00:00 -07:00
|
8
8
|
summary: A game library for Ruby
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -44,140 +44,9 @@ files:
|
|
44
44
|
- test/test_zyps.rb
|
45
45
|
- test/zyps
|
46
46
|
- test/zyps/test_actions.rb
|
47
|
+
- test/zyps/test_behaviors.rb
|
47
48
|
- test/zyps/test_conditions.rb
|
48
49
|
- test/zyps/test_environmental_factors.rb
|
49
|
-
- doc/classes
|
50
|
-
- doc/classes/AccelerateAction.html
|
51
|
-
- doc/classes/AccelerateAction.src
|
52
|
-
- doc/classes/AccelerateAction.src/M000009.html
|
53
|
-
- doc/classes/AccelerateAction.src/M000010.html
|
54
|
-
- doc/classes/Action.html
|
55
|
-
- doc/classes/AgeCondition.html
|
56
|
-
- doc/classes/AgeCondition.src
|
57
|
-
- doc/classes/AgeCondition.src/M000039.html
|
58
|
-
- doc/classes/AgeCondition.src/M000040.html
|
59
|
-
- doc/classes/ApproachAction.html
|
60
|
-
- doc/classes/ApproachAction.src
|
61
|
-
- doc/classes/ApproachAction.src/M000048.html
|
62
|
-
- doc/classes/ApproachAction.src/M000049.html
|
63
|
-
- doc/classes/Behavior.html
|
64
|
-
- doc/classes/Behavior.src
|
65
|
-
- doc/classes/Behavior.src/M000001.html
|
66
|
-
- doc/classes/Behavior.src/M000002.html
|
67
|
-
- doc/classes/BlendAction.html
|
68
|
-
- doc/classes/BlendAction.src
|
69
|
-
- doc/classes/BlendAction.src/M000043.html
|
70
|
-
- doc/classes/BlendAction.src/M000044.html
|
71
|
-
- doc/classes/Clock.html
|
72
|
-
- doc/classes/Clock.src
|
73
|
-
- doc/classes/Clock.src/M000041.html
|
74
|
-
- doc/classes/Clock.src/M000042.html
|
75
|
-
- doc/classes/CollisionCondition.html
|
76
|
-
- doc/classes/CollisionCondition.src
|
77
|
-
- doc/classes/CollisionCondition.src/M000053.html
|
78
|
-
- doc/classes/Color.html
|
79
|
-
- doc/classes/Color.src
|
80
|
-
- doc/classes/Color.src/M000022.html
|
81
|
-
- doc/classes/Color.src/M000023.html
|
82
|
-
- doc/classes/Color.src/M000024.html
|
83
|
-
- doc/classes/Color.src/M000025.html
|
84
|
-
- doc/classes/Color.src/M000026.html
|
85
|
-
- doc/classes/Color.src/M000027.html
|
86
|
-
- doc/classes/Condition.html
|
87
|
-
- doc/classes/Creature.html
|
88
|
-
- doc/classes/Creature.src
|
89
|
-
- doc/classes/Creature.src/M000011.html
|
90
|
-
- doc/classes/Creature.src/M000012.html
|
91
|
-
- doc/classes/DestroyAction.html
|
92
|
-
- doc/classes/DestroyAction.src
|
93
|
-
- doc/classes/DestroyAction.src/M000030.html
|
94
|
-
- doc/classes/DestroyAction.src/M000031.html
|
95
|
-
- doc/classes/EatAction.html
|
96
|
-
- doc/classes/EatAction.src
|
97
|
-
- doc/classes/EatAction.src/M000045.html
|
98
|
-
- doc/classes/Enclosure.html
|
99
|
-
- doc/classes/Enclosure.src
|
100
|
-
- doc/classes/Enclosure.src/M000005.html
|
101
|
-
- doc/classes/Enclosure.src/M000006.html
|
102
|
-
- doc/classes/Environment.html
|
103
|
-
- doc/classes/Environment.src
|
104
|
-
- doc/classes/Environment.src/M000046.html
|
105
|
-
- doc/classes/Environment.src/M000047.html
|
106
|
-
- doc/classes/EnvironmentalFactor.html
|
107
|
-
- doc/classes/FaceAction.html
|
108
|
-
- doc/classes/FaceAction.src
|
109
|
-
- doc/classes/FaceAction.src/M000052.html
|
110
|
-
- doc/classes/FleeAction.html
|
111
|
-
- doc/classes/FleeAction.src
|
112
|
-
- doc/classes/FleeAction.src/M000054.html
|
113
|
-
- doc/classes/FleeAction.src/M000055.html
|
114
|
-
- doc/classes/GameObject.html
|
115
|
-
- doc/classes/GameObject.src
|
116
|
-
- doc/classes/GameObject.src/M000032.html
|
117
|
-
- doc/classes/GameObject.src/M000033.html
|
118
|
-
- doc/classes/GameObject.src/M000034.html
|
119
|
-
- doc/classes/GameObject.src/M000035.html
|
120
|
-
- doc/classes/GameObject.src/M000036.html
|
121
|
-
- doc/classes/Location.html
|
122
|
-
- doc/classes/Location.src
|
123
|
-
- doc/classes/Location.src/M000021.html
|
124
|
-
- doc/classes/ProximityCondition.html
|
125
|
-
- doc/classes/ProximityCondition.src
|
126
|
-
- doc/classes/ProximityCondition.src/M000037.html
|
127
|
-
- doc/classes/ProximityCondition.src/M000038.html
|
128
|
-
- doc/classes/TagAction.html
|
129
|
-
- doc/classes/TagAction.src
|
130
|
-
- doc/classes/TagAction.src/M000028.html
|
131
|
-
- doc/classes/TagAction.src/M000029.html
|
132
|
-
- doc/classes/TagCondition.html
|
133
|
-
- doc/classes/TagCondition.src
|
134
|
-
- doc/classes/TagCondition.src/M000007.html
|
135
|
-
- doc/classes/TagCondition.src/M000008.html
|
136
|
-
- doc/classes/TrailsView.html
|
137
|
-
- doc/classes/TrailsView.src
|
138
|
-
- doc/classes/TrailsView.src/M000003.html
|
139
|
-
- doc/classes/TrailsView.src/M000004.html
|
140
|
-
- doc/classes/TurnAction.html
|
141
|
-
- doc/classes/TurnAction.src
|
142
|
-
- doc/classes/TurnAction.src/M000050.html
|
143
|
-
- doc/classes/TurnAction.src/M000051.html
|
144
|
-
- doc/classes/Utility.html
|
145
|
-
- doc/classes/Utility.src
|
146
|
-
- doc/classes/Utility.src/M000056.html
|
147
|
-
- doc/classes/Utility.src/M000057.html
|
148
|
-
- doc/classes/Utility.src/M000058.html
|
149
|
-
- doc/classes/Utility.src/M000059.html
|
150
|
-
- doc/classes/Utility.src/M000060.html
|
151
|
-
- doc/classes/Utility.src/M000061.html
|
152
|
-
- doc/classes/Utility.src/M000062.html
|
153
|
-
- doc/classes/Vector.html
|
154
|
-
- doc/classes/Vector.src
|
155
|
-
- doc/classes/Vector.src/M000013.html
|
156
|
-
- doc/classes/Vector.src/M000014.html
|
157
|
-
- doc/classes/Vector.src/M000015.html
|
158
|
-
- doc/classes/Vector.src/M000016.html
|
159
|
-
- doc/classes/Vector.src/M000017.html
|
160
|
-
- doc/classes/Vector.src/M000018.html
|
161
|
-
- doc/classes/Vector.src/M000019.html
|
162
|
-
- doc/classes/Vector.src/M000020.html
|
163
|
-
- doc/created.rid
|
164
|
-
- doc/files
|
165
|
-
- doc/files/COPYING_LESSER_txt.html
|
166
|
-
- doc/files/COPYING_txt.html
|
167
|
-
- doc/files/lib
|
168
|
-
- doc/files/lib/zyps
|
169
|
-
- doc/files/lib/zyps/actions_rb.html
|
170
|
-
- doc/files/lib/zyps/conditions_rb.html
|
171
|
-
- doc/files/lib/zyps/environmental_factors_rb.html
|
172
|
-
- doc/files/lib/zyps/views
|
173
|
-
- doc/files/lib/zyps/views/trails_rb.html
|
174
|
-
- doc/files/lib/zyps_rb.html
|
175
|
-
- doc/files/README_txt.html
|
176
|
-
- doc/fr_class_index.html
|
177
|
-
- doc/fr_file_index.html
|
178
|
-
- doc/fr_method_index.html
|
179
|
-
- doc/index.html
|
180
|
-
- doc/rdoc-style.css
|
181
50
|
test_files:
|
182
51
|
- test/test_zyps.rb
|
183
52
|
rdoc_options:
|
@@ -1,182 +0,0 @@
|
|
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: AccelerateAction</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">AccelerateAction</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/zyps/actions_rb.html">
|
59
|
-
lib/zyps/actions.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="Action.html">
|
69
|
-
Action
|
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
|
-
Increase/decrease speed over time.
|
86
|
-
</p>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
|
90
|
-
|
91
|
-
</div>
|
92
|
-
|
93
|
-
<div id="method-list">
|
94
|
-
<h3 class="section-bar">Methods</h3>
|
95
|
-
|
96
|
-
<div class="name-list">
|
97
|
-
<a href="#M000010">do</a>
|
98
|
-
<a href="#M000009">new</a>
|
99
|
-
</div>
|
100
|
-
</div>
|
101
|
-
|
102
|
-
</div>
|
103
|
-
|
104
|
-
|
105
|
-
<!-- if includes -->
|
106
|
-
|
107
|
-
<div id="section">
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<div id="attribute-list">
|
114
|
-
<h3 class="section-bar">Attributes</h3>
|
115
|
-
|
116
|
-
<div class="name-list">
|
117
|
-
<table>
|
118
|
-
<tr class="top-aligned-row context-row">
|
119
|
-
<td class="context-item-name">rate</td>
|
120
|
-
<td class="context-item-value"> [RW] </td>
|
121
|
-
<td class="context-item-desc">
|
122
|
-
Units per second to accelerate. Can be negative to slow down or go in
|
123
|
-
reverse.
|
124
|
-
|
125
|
-
</td>
|
126
|
-
</tr>
|
127
|
-
</table>
|
128
|
-
</div>
|
129
|
-
</div>
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<!-- if method_list -->
|
134
|
-
<div id="methods">
|
135
|
-
<h3 class="section-bar">Public Class methods</h3>
|
136
|
-
|
137
|
-
<div id="method-M000009" class="method-detail">
|
138
|
-
<a name="M000009"></a>
|
139
|
-
|
140
|
-
<div class="method-heading">
|
141
|
-
<a href="AccelerateAction.src/M000009.html" target="Code" class="method-signature"
|
142
|
-
onclick="popupCode('AccelerateAction.src/M000009.html');return false;">
|
143
|
-
<span class="method-name">new</span><span class="method-args">(rate = 0)</span>
|
144
|
-
</a>
|
145
|
-
</div>
|
146
|
-
|
147
|
-
<div class="method-description">
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
152
|
-
|
153
|
-
<div id="method-M000010" class="method-detail">
|
154
|
-
<a name="M000010"></a>
|
155
|
-
|
156
|
-
<div class="method-heading">
|
157
|
-
<a href="AccelerateAction.src/M000010.html" target="Code" class="method-signature"
|
158
|
-
onclick="popupCode('AccelerateAction.src/M000010.html');return false;">
|
159
|
-
<span class="method-name">do</span><span class="method-args">(actor, target)</span>
|
160
|
-
</a>
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div class="method-description">
|
164
|
-
<p>
|
165
|
-
Increase or decrease speed according to elapsed time.
|
166
|
-
</p>
|
167
|
-
</div>
|
168
|
-
</div>
|
169
|
-
|
170
|
-
|
171
|
-
</div>
|
172
|
-
|
173
|
-
|
174
|
-
</div>
|
175
|
-
|
176
|
-
|
177
|
-
<div id="validator-badges">
|
178
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
179
|
-
</div>
|
180
|
-
|
181
|
-
</body>
|
182
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
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 (AccelerateAction)</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/actions.rb, line 34</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">rate</span> = <span class="ruby-value">0</span>)
|
15
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rate</span> = <span class="ruby-identifier">rate</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>
|
@@ -1,18 +0,0 @@
|
|
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>do (AccelerateAction)</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/actions.rb, line 39</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">do</span>(<span class="ruby-identifier">actor</span>, <span class="ruby-identifier">target</span>)
|
15
|
-
<span class="ruby-identifier">actor</span>.<span class="ruby-identifier">vector</span>.<span class="ruby-identifier">speed</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@clock</span>.<span class="ruby-identifier">elapsed_time</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">rate</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|