|
@@ -40,8 +40,10 @@ from opencombat.simulation.event import NewVisibleOpponent
|
40
|
40
|
from opencombat.simulation.event import NoLongerVisibleOpponent
|
41
|
41
|
from opencombat.simulation.event import FireEvent
|
42
|
42
|
from opencombat.simulation.event import DieEvent
|
43
|
|
-from opencombat.simulation.subject import TileSubject as ManSubject
|
|
43
|
+from opencombat.simulation.subject import ManSubject
|
|
44
|
+from opencombat.simulation.subject import TankSubject
|
44
|
45
|
from opencombat.gui.actor import Man as ManActor
|
|
46
|
+from opencombat.gui.actor import HeavyVehicle as HeavyVehicleActor
|
45
|
47
|
|
46
|
48
|
|
47
|
49
|
class EditLayer(BaseEditLayer):
|
|
@@ -228,16 +230,6 @@ class Game(TMXGui):
|
228
|
230
|
self.subject_die,
|
229
|
231
|
)
|
230
|
232
|
|
231
|
|
- # configs / resources
|
232
|
|
- self.move_duration_ref = float(self.config.resolve(
|
233
|
|
- 'game.move.walk_ref_time',
|
234
|
|
- ))
|
235
|
|
- self.move_fast_duration_ref = float(self.config.resolve(
|
236
|
|
- 'game.move.run_ref_time',
|
237
|
|
- ))
|
238
|
|
- self.move_crawl_duration_ref = float(self.config.resolve(
|
239
|
|
- 'game.move.crawl_ref_time',
|
240
|
|
- ))
|
241
|
233
|
self.dead_soldier_image = pyglet.resource.image(self.graphic_path_manager.path(
|
242
|
234
|
'actors/man_d1.png',
|
243
|
235
|
))
|
|
@@ -247,6 +239,10 @@ class Game(TMXGui):
|
247
|
239
|
ManSubject,
|
248
|
240
|
SubjectMapper(self.config, ManActor),
|
249
|
241
|
)
|
|
242
|
+ self.subject_mapper_factory.register_mapper(
|
|
243
|
+ TankSubject,
|
|
244
|
+ SubjectMapper(self.config, HeavyVehicleActor),
|
|
245
|
+ )
|
250
|
246
|
|
251
|
247
|
def before_run(self) -> None:
|
252
|
248
|
from opencombat.gui.move import MoveActorInteraction
|
|
@@ -273,18 +269,18 @@ class Game(TMXGui):
|
273
|
269
|
if event.gui_action == UserAction.ORDER_MOVE:
|
274
|
270
|
animation = ANIMATION_WALK
|
275
|
271
|
cycle_duration = 2
|
276
|
|
- move_duration = self.move_duration_ref
|
277
|
272
|
elif event.gui_action == UserAction.ORDER_MOVE_FAST:
|
278
|
273
|
animation = ANIMATION_WALK
|
279
|
274
|
cycle_duration = 0.5
|
280
|
|
- move_duration = self.move_fast_duration_ref
|
281
|
275
|
elif event.gui_action == UserAction.ORDER_MOVE_CRAWL:
|
282
|
276
|
animation = ANIMATION_CRAWL
|
283
|
277
|
cycle_duration = 2
|
284
|
|
- move_duration = self.move_crawl_duration_ref
|
285
|
278
|
else:
|
286
|
|
- raise NotImplementedError()
|
|
279
|
+ raise NotImplementedError(
|
|
280
|
+ 'Gui action {} unknown'.format(event.gui_action)
|
|
281
|
+ )
|
287
|
282
|
|
|
283
|
+ move_duration = event.move_duration
|
288
|
284
|
move_action = MoveTo(new_world_position, move_duration)
|
289
|
285
|
actor.do(move_action)
|
290
|
286
|
actor.do(Animate(animation, duration=move_duration, cycle_duration=cycle_duration))
|