|
@@ -70,7 +70,7 @@ class Walk(State):
|
70
|
70
|
if c.arm == None:
|
71
|
71
|
|
72
|
72
|
c.arm = o.childrenRecursive['Char4']
|
73
|
|
-
|
|
73
|
+ c.deck_arm = o.childrenRecursive['deck_arm']
|
74
|
74
|
self.walk_weight = 1
|
75
|
75
|
self.run_weight = 1
|
76
|
76
|
self.run_speed = 0.0
|
|
@@ -100,10 +100,21 @@ class Walk(State):
|
100
|
100
|
# print('request reg offboard')
|
101
|
101
|
# if self.FSM.stateLife > 5:
|
102
|
102
|
# o['requestAction'] = 'reg_idle'
|
|
103
|
+ c.align_walk_z()
|
103
|
104
|
ground_rays = c.get_ground_ray()
|
|
105
|
+ #77777777777777777777777777777777777777777777777777777777777777777777777777777777777
|
|
106
|
+ c.get_hang_align_ray()
|
|
107
|
+ c.move_walk_cam()
|
|
108
|
+ c.check_reset_point()
|
|
109
|
+ c.check_throw()
|
|
110
|
+
|
104
|
111
|
if ground_rays[0][0] != None:
|
105
|
112
|
dist = c.get_ground_dist(ground_rays)
|
106
|
|
- c.set_walk_z(dist)
|
|
113
|
+ if dist > .7:
|
|
114
|
+ self.FSM.ToTransition('toWalkAir')
|
|
115
|
+ print('---falling')
|
|
116
|
+ else:
|
|
117
|
+ c.set_walk_z(dist)
|
107
|
118
|
#print(dist, 'setting height')
|
108
|
119
|
|
109
|
120
|
if self.FSM.stateLife > 4:
|
|
@@ -121,14 +132,14 @@ class Walk(State):
|
121
|
132
|
def check_onboard(self):
|
122
|
133
|
|
123
|
134
|
o = self.FSM.owner.obj
|
124
|
|
- print(o['getonboard'], 'getonboard')
|
|
135
|
+ #print(o['getonboard'], 'getonboard')
|
125
|
136
|
|
126
|
137
|
|
127
|
138
|
|
128
|
139
|
if dict['walk'] == 0:
|
129
|
140
|
o['getonboard'] = True
|
130
|
141
|
self.FSM.ToTransition('toRoll')
|
131
|
|
- print('onboard', dict['walk'], o['getonboard'])
|
|
142
|
+ #print('onboard', dict['walk'], o['getonboard'])
|
132
|
143
|
|
133
|
144
|
|
134
|
145
|
|
|
@@ -145,14 +156,20 @@ class Walk(State):
|
145
|
156
|
|
146
|
157
|
def idle_blend(self):
|
147
|
158
|
arm = self.FSM.owner.arm
|
|
159
|
+ deck = self.FSM.owner.deck_arm
|
148
|
160
|
arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=10)
|
|
161
|
+ deck.playAction('b_reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=10)
|
149
|
162
|
if self.FSM.stateLife > 20:
|
150
|
163
|
frame = arm.getActionFrame(2) + .5 * self.run_speed
|
151
|
164
|
if frame > 30:
|
152
|
165
|
frame = 0
|
153
|
166
|
arm.stopAction(2)
|
|
167
|
+ deck.stopAction(2)
|
154
|
168
|
arm.playAction('reg_nwalk3', 0,30, layer=2, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
|
|
169
|
+ deck.playAction('b_reg_walk', 0,30, layer=2, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
|
|
170
|
+ #b_reg_walk
|
155
|
171
|
arm.setActionFrame(frame, 2)
|
|
172
|
+ deck.setActionFrame(frame, 2)
|
156
|
173
|
#print(self.walk_weight, frame)
|
157
|
174
|
|
158
|
175
|
|
|
@@ -161,8 +178,12 @@ class Walk(State):
|
161
|
178
|
if frame > 30:
|
162
|
179
|
frame = 0
|
163
|
180
|
arm.stopAction(3)
|
|
181
|
+ deck.stopAction(3)
|
164
|
182
|
arm.playAction('reg_run.003', 0,30, layer=3, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
|
|
183
|
+ deck.playAction('b_reg_run', 0,30, layer=3, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
|
|
184
|
+
|
165
|
185
|
arm.setActionFrame(frame, 3)
|
|
186
|
+ deck.setActionFrame(frame, 3)
|
166
|
187
|
#print(frame, 'frame')
|
167
|
188
|
#print(self.run_weight, frame)
|
168
|
189
|
|
|
@@ -229,6 +250,10 @@ class Walk(State):
|
229
|
250
|
self.FSM.owner.arm.stopAction(1)
|
230
|
251
|
self.FSM.owner.arm.stopAction(2)
|
231
|
252
|
self.FSM.owner.arm.stopAction(3)
|
|
253
|
+ self.FSM.owner.deck_arm.stopAction(0)
|
|
254
|
+ self.FSM.owner.deck_arm.stopAction(1)
|
|
255
|
+ self.FSM.owner.deck_arm.stopAction(2)
|
|
256
|
+ self.FSM.owner.deck_arm.stopAction(3)
|
232
|
257
|
dict['walk'] = 0
|
233
|
258
|
|
234
|
259
|
|
|
@@ -240,35 +265,50 @@ class WalkAir(State):
|
240
|
265
|
|
241
|
266
|
def Enter(self):
|
242
|
267
|
self.FSM.stateLife = 1
|
243
|
|
- #arm = self.FSM.owner.arm
|
244
|
|
- #arm.playAction('a_jump_t', 27, 27, layer=1, play_mode=0, speed=1, blendin=5)
|
245
|
268
|
super(WalkAir, self).Enter()
|
246
|
269
|
|
247
|
270
|
def Execute(self):
|
248
|
271
|
self.FSM.stateLife += 1
|
249
|
|
- #self.FSM.ToTransition('toLand')
|
|
272
|
+ self.FSM.owner.check_reset_point()
|
250
|
273
|
arm = self.FSM.owner.arm
|
251
|
|
- arm.playAction('a_jump_t', 23, 23, layer=3, play_mode=1, speed=1, blendin=5)
|
252
|
|
- #if self.FSM.stateLife > 50:
|
253
|
|
- #self.FSM.ToTransition('toWalk')
|
254
|
|
- #limit fall speed
|
|
274
|
+ deck_arm = self.FSM.owner.deck_arm
|
|
275
|
+ #arm.playAction('a_jump_t', 23, 23, layer=3, play_mode=1, speed=1, blendin=5)
|
|
276
|
+ arm.playAction('c_jump_up', 23, 23, layer=3, play_mode=1, speed=1, blendin=15)
|
|
277
|
+ deck_arm.playAction('b_walk_jump', 23, 23, layer=3, play_mode=1, speed=1, blendin=15)
|
|
278
|
+
|
255
|
279
|
if self.FSM.owner.obj.linearVelocity.z < -10:
|
256
|
280
|
self.FSM.owner.obj.linearVelocity.z = -10
|
257
|
|
- #ground_rays = self.FSM.owner.get_ground_ray()
|
|
281
|
+ moving = self.FSM.owner.walk_movement()
|
258
|
282
|
ground_rays = self.FSM.owner.get_ground_ray()
|
259
|
|
- if ground_rays[0][0] != None:
|
260
|
283
|
|
|
284
|
+ self.FSM.owner.check_throw()
|
|
285
|
+ if ground_rays[0][0] != None:
|
261
|
286
|
dist = self.FSM.owner.get_ground_dist(ground_rays)
|
262
|
287
|
if dist < .4:
|
263
|
|
- self.FSM.ToTransition('toWalkLand')
|
|
288
|
+ self.FSM.ToTransition('toWalkLand')
|
264
|
289
|
|
265
|
|
- moving = self.FSM.owner.walk_movement()
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+ if dist > .5 and self.FSM.owner.obj.worldPosition.z < self.FSM.owner.last_pos.z:
|
|
293
|
+ hang_ray = self.FSM.owner.get_hang_ray()
|
|
294
|
+ hang_align_ray = self.FSM.owner.get_hang_align_ray()
|
|
295
|
+
|
|
296
|
+ if hang_ray[0] != None and hang_align_ray[0] != None and self.FSM.prevState != 'WalkHang' and dict['lUD'] < .04:
|
|
297
|
+ hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
|
|
298
|
+ if hr_dist < .1:
|
|
299
|
+ self.FSM.owner.obj.linearVelocity = [0,0,0]
|
|
300
|
+ self.FSM.owner.obj.worldPosition.z = hang_ray[1].z - 1
|
|
301
|
+ self.FSM.ToTransition('toWalkHang')
|
266
|
302
|
|
267
|
303
|
def Exit(self):
|
268
|
304
|
self.FSM.owner.arm.stopAction(0)
|
269
|
305
|
self.FSM.owner.arm.stopAction(1)
|
270
|
306
|
self.FSM.owner.arm.stopAction(2)
|
271
|
307
|
self.FSM.owner.arm.stopAction(3)
|
|
308
|
+ self.FSM.owner.deck_arm.stopAction(0)
|
|
309
|
+ self.FSM.owner.deck_arm.stopAction(1)
|
|
310
|
+ self.FSM.owner.deck_arm.stopAction(2)
|
|
311
|
+ self.FSM.owner.deck_arm.stopAction(3)
|
272
|
312
|
|
273
|
313
|
#====================================
|
274
|
314
|
|
|
@@ -280,7 +320,10 @@ class WalkJump(State):
|
280
|
320
|
self.FSM.stateLife = 1
|
281
|
321
|
|
282
|
322
|
arm = self.FSM.owner.arm
|
283
|
|
- arm.playAction('a_jump_t', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
|
|
323
|
+ deck = self.FSM.owner.deck_arm
|
|
324
|
+ #arm.playAction('a_jump_t', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
|
|
325
|
+ arm.playAction('c_jump_up', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
|
|
326
|
+ deck.playAction('b_walk_jump', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
|
284
|
327
|
|
285
|
328
|
|
286
|
329
|
super(WalkJump, self).Enter()
|
|
@@ -311,7 +354,10 @@ class WalkLand(State):
|
311
|
354
|
|
312
|
355
|
def Enter(self):
|
313
|
356
|
self.FSM.stateLife = 1
|
314
|
|
- self.FSM.owner.arm.playAction('a_jump_t', 23, 50, layer=5, play_mode=0, speed=1, blendin=5)
|
|
357
|
+ #self.FSM.owner.arm.playAction('a_jump_t', 23, 50, layer=5, play_mode=0, speed=1, blendin=5)
|
|
358
|
+ self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
|
|
359
|
+ self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
|
|
360
|
+ #c_land
|
315
|
361
|
super(WalkLand, self).Enter()
|
316
|
362
|
|
317
|
363
|
def Execute(self):
|
|
@@ -325,7 +371,7 @@ class WalkLand(State):
|
325
|
371
|
# print('stopping land')
|
326
|
372
|
# arm.stopAction(5)
|
327
|
373
|
# arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=2)
|
328
|
|
- if self.FSM.stateLife > 8:
|
|
374
|
+ if self.FSM.stateLife > 30:
|
329
|
375
|
self.FSM.ToTransition('toWalk')
|
330
|
376
|
|
331
|
377
|
ground_rays = self.FSM.owner.get_ground_ray()
|
|
@@ -344,12 +390,56 @@ class WalkHang(State):
|
344
|
390
|
|
345
|
391
|
def Enter(self):
|
346
|
392
|
self.FSM.stateLife = 1
|
|
393
|
+ self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
|
|
394
|
+ self.moveable = False
|
|
395
|
+ #self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
|
347
|
396
|
super(WalkHang, self).Enter()
|
348
|
397
|
|
349
|
398
|
def Execute(self):
|
350
|
399
|
self.FSM.stateLife += 1
|
351
|
|
- #self.FSM.ToTransition('toLand')
|
|
400
|
+ self.FSM.owner.obj.linearVelocity = [0,0,0]
|
|
401
|
+ #self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
|
|
402
|
+ self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
|
|
403
|
+ if dict['lUD'] > .04:
|
|
404
|
+ self.FSM.ToTransition('toWalkAir')
|
|
405
|
+
|
352
|
406
|
|
|
407
|
+ self.FSM.owner.move_walk_cam()
|
|
408
|
+ if self.FSM.stateLife > 25:
|
|
409
|
+ self.moveable = True
|
|
410
|
+ if self.moveable:
|
|
411
|
+ if dict['lUD'] < -.04:
|
|
412
|
+ self.FSM.ToTransition('toWalkClimb')
|
|
413
|
+ self.FSM.owner.hang_move()
|
|
414
|
+ ground_rays = self.FSM.owner.get_ground_ray()
|
|
415
|
+ if ground_rays[0][0] != None:
|
|
416
|
+ dist = self.FSM.owner.get_ground_dist(ground_rays)
|
|
417
|
+ if dist < .4:
|
|
418
|
+ self.FSM.ToTransition('toWalkLand')
|
|
419
|
+
|
|
420
|
+ hang_ray = self.FSM.owner.get_hang_ray()
|
|
421
|
+ hang_align_ray = self.FSM.owner.get_hang_align_ray()
|
|
422
|
+ #print(hang_align_ray, 'hang_align_ray')
|
|
423
|
+ #self.FSM.owner.hang_move()
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+ if hang_ray[0] != None:
|
|
428
|
+ hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
|
|
429
|
+ print(hr_dist, 'hang dist')
|
|
430
|
+ if hr_dist < .5:
|
|
431
|
+ self.FSM.owner.obj.linearVelocity = [0,0,0]
|
|
432
|
+ self.FSM.owner.obj.worldPosition.z = hang_ray[1].z - 1
|
|
433
|
+ if hang_align_ray[0] != None:
|
|
434
|
+ print(hang_align_ray[0])
|
|
435
|
+ v = hang_align_ray[2]
|
|
436
|
+ self.FSM.owner.obj.alignAxisToVect(v, 0, .5)
|
|
437
|
+ else:
|
|
438
|
+ self.FSM.ToTransition('toWalkAir')
|
|
439
|
+ if hang_align_ray[0] == None:
|
|
440
|
+ self.FSM.ToTransition('toWalkAir')
|
|
441
|
+
|
|
442
|
+ self.FSM.owner.align_walk_z()
|
353
|
443
|
def Exit(self):
|
354
|
444
|
pass
|
355
|
445
|
|
|
@@ -361,12 +451,20 @@ class WalkClimb(State):
|
361
|
451
|
|
362
|
452
|
def Enter(self):
|
363
|
453
|
self.FSM.stateLife = 1
|
|
454
|
+ self.FSM.owner.arm.playAction('c_wallclimb', 1, 50, layer=3, play_mode=0, speed=1, blendin=10)
|
364
|
455
|
super(WalkClimb, self).Enter()
|
365
|
456
|
|
366
|
457
|
def Execute(self):
|
367
|
458
|
self.FSM.stateLife += 1
|
368
|
459
|
#self.FSM.ToTransition('toLand')
|
369
|
460
|
|
|
461
|
+ if self.FSM.stateLife > 25:
|
|
462
|
+ self.FSM.owner.obj.applyForce([-300, 0, 80], True)
|
|
463
|
+ else:
|
|
464
|
+ self.FSM.owner.obj.applyForce([-20, 0, 80], True)
|
|
465
|
+ if self.FSM.stateLife > 35:
|
|
466
|
+ self.FSM.ToTransition('toWalkLand')
|
|
467
|
+
|
370
|
468
|
def Exit(self):
|
371
|
469
|
pass
|
372
|
470
|
|
|
@@ -389,6 +487,60 @@ class WalkHurdle(State):
|
389
|
487
|
|
390
|
488
|
|
391
|
489
|
#====================================
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+class Example(State):
|
|
493
|
+ def __init__(self,FSM):
|
|
494
|
+ super(Example, self).__init__(FSM)
|
|
495
|
+
|
|
496
|
+ def Enter(self):
|
|
497
|
+ self.FSM.stateLife = 1
|
|
498
|
+ super(Example, self).Enter()
|
|
499
|
+
|
|
500
|
+ def Execute(self):
|
|
501
|
+ self.FSM.stateLife += 1
|
|
502
|
+ #self.FSM.ToTransition('toExample')
|
|
503
|
+
|
|
504
|
+ def Exit(self):
|
|
505
|
+ pass
|
|
506
|
+
|
|
507
|
+#====================================
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+class Example(State):
|
|
511
|
+ def __init__(self,FSM):
|
|
512
|
+ super(Example, self).__init__(FSM)
|
|
513
|
+
|
|
514
|
+ def Enter(self):
|
|
515
|
+ self.FSM.stateLife = 1
|
|
516
|
+ super(Example, self).Enter()
|
|
517
|
+
|
|
518
|
+ def Execute(self):
|
|
519
|
+ self.FSM.stateLife += 1
|
|
520
|
+ #self.FSM.ToTransition('toExample')
|
|
521
|
+
|
|
522
|
+ def Exit(self):
|
|
523
|
+ pass
|
|
524
|
+
|
|
525
|
+#====================================
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+class Example(State):
|
|
529
|
+ def __init__(self,FSM):
|
|
530
|
+ super(Example, self).__init__(FSM)
|
|
531
|
+
|
|
532
|
+ def Enter(self):
|
|
533
|
+ self.FSM.stateLife = 1
|
|
534
|
+ super(Example, self).Enter()
|
|
535
|
+
|
|
536
|
+ def Execute(self):
|
|
537
|
+ self.FSM.stateLife += 1
|
|
538
|
+ #self.FSM.ToTransition('toExample')
|
|
539
|
+
|
|
540
|
+ def Exit(self):
|
|
541
|
+ pass
|
|
542
|
+
|
|
543
|
+#====================================
|
392
|
544
|
|
393
|
545
|
class Roll(State):
|
394
|
546
|
def __init__(self,FSM):
|
|
@@ -397,6 +549,7 @@ class Roll(State):
|
397
|
549
|
def Enter(self):
|
398
|
550
|
self.FSM.stateLife = 1
|
399
|
551
|
self.FSM.owner.walking = False
|
|
552
|
+ self.FSM.owner.obj['getonboard'] = False
|
400
|
553
|
dict['walking'] = False
|
401
|
554
|
super(Roll, self).Enter()
|
402
|
555
|
|
|
@@ -407,6 +560,8 @@ class Roll(State):
|
407
|
560
|
self.FSM.owner.obj['getoffboard'] = True
|
408
|
561
|
self.FSM.ToTransition('toWalk')
|
409
|
562
|
print('fsm to walk')
|
|
563
|
+ if self.FSM.owner.obj['fall'] == True:
|
|
564
|
+ self.FSM.ToTransition('toRagdoll')
|
410
|
565
|
print('rolling')
|
411
|
566
|
#self.FSM.ToTransition('toLand')
|
412
|
567
|
|
|
@@ -414,3 +569,24 @@ class Roll(State):
|
414
|
569
|
pass
|
415
|
570
|
|
416
|
571
|
#====================================
|
|
572
|
+
|
|
573
|
+class Ragdoll(State):
|
|
574
|
+ def __init__(self,FSM):
|
|
575
|
+ super(Ragdoll, self).__init__(FSM)
|
|
576
|
+
|
|
577
|
+ def Enter(self):
|
|
578
|
+ self.FSM.stateLife = 1
|
|
579
|
+ super(Ragdoll, self).Enter()
|
|
580
|
+
|
|
581
|
+ def Execute(self):
|
|
582
|
+ self.FSM.stateLife += 1
|
|
583
|
+ print('ragdolling')
|
|
584
|
+ if dict['yBut'] == 1:
|
|
585
|
+ self.FSM.owner.obj['fall'] = False
|
|
586
|
+ self.FSM.owner.cont.activate(self.FSM.owner.cont.actuators['walk'])
|
|
587
|
+ self.FSM.ToTransition('toWalk')
|
|
588
|
+
|
|
589
|
+ def Exit(self):
|
|
590
|
+ pass
|
|
591
|
+
|
|
592
|
+#====================================
|