|
@@ -1,147 +1,140 @@
|
1
|
|
-import bge
|
2
|
|
-import menuV3
|
3
|
|
-import Settings
|
4
|
|
-
|
5
|
|
-
|
6
|
|
-#replay huds:
|
7
|
|
-#add_hud
|
8
|
|
-#remove_hud (on control_cube)
|
9
|
|
-
|
10
|
|
-def main():
|
11
|
|
-
|
12
|
|
- cont = bge.logic.getCurrentController()
|
13
|
|
- scene = bge.logic.getCurrentScene()
|
14
|
|
- #own = cont.owner
|
15
|
|
- dict = bge.logic.globalDict
|
16
|
|
-
|
17
|
|
- skater = scene.objects["Char4"]
|
18
|
|
- deck = scene.objects["deck"]
|
19
|
|
- trucks = scene.objects["trucks"]
|
20
|
|
- own = scene.objects["control_cube.002"]
|
21
|
|
-
|
22
|
|
- camList = scene.cameras
|
23
|
|
- freecam = camList["freecam"]
|
24
|
|
- mcam = camList['Camera.003']
|
25
|
|
-
|
26
|
|
- #freecam = scene.objects['freecam']
|
27
|
|
- cube = scene.objects['control_cube.002']
|
28
|
|
-
|
29
|
|
- try:
|
30
|
|
- pause_state = dict['npause']
|
31
|
|
- last_pause = dict['last_npause']
|
32
|
|
- except:
|
33
|
|
- dict['npause'] = 0
|
34
|
|
- dict['last_npause'] = 0
|
35
|
|
- pause_state = 0
|
36
|
|
- last_pause = 0
|
37
|
|
-
|
38
|
|
-
|
39
|
|
- def printplaying():
|
40
|
|
- splaying_layers = "S: "
|
41
|
|
- playing_layers = "D: "
|
42
|
|
- tplaying_layers = "T: "
|
43
|
|
- for x in range(1000):
|
44
|
|
- if skater.isPlayingAction(x):
|
45
|
|
- #if trucks.isPlayingAction(x):
|
46
|
|
- #if skater.isPlayingAction(x):
|
47
|
|
- splaying_layers += str(x)
|
48
|
|
- splaying_layers += " "
|
49
|
|
- if deck.isPlayingAction(x):
|
50
|
|
- #if trucks.isPlayingAction(x):
|
51
|
|
- #if skater.isPlayingAction(x):
|
52
|
|
- playing_layers += str(x)
|
53
|
|
- playing_layers += " "
|
54
|
|
- if trucks.isPlayingAction(x):
|
55
|
|
- #if trucks.isPlayingAction(x):
|
56
|
|
- #if skater.isPlayingAction(x):
|
57
|
|
- tplaying_layers += str(x)
|
58
|
|
- tplaying_layers += " "
|
59
|
|
- print(splaying_layers, playing_layers, tplaying_layers)
|
60
|
|
-
|
61
|
|
-
|
62
|
|
- #switch pause state
|
63
|
|
- if dict['stBut'] == True and dict['last_stBut'] == False:
|
64
|
|
- if pause_state == 0:
|
65
|
|
- pause_state = 1
|
66
|
|
- else:
|
67
|
|
- pause_state = 0
|
68
|
|
- dict['npause'] = pause_state
|
69
|
|
-
|
70
|
|
- #enter pause
|
71
|
|
- if pause_state == 1 and last_pause == 0:
|
72
|
|
- own.suspendDynamics()
|
73
|
|
- own['pre_pause_linvel'] = [own['linvelx'], own['linVely'], 0]
|
74
|
|
- own.setLinearVelocity([0,0,0],1)
|
75
|
|
- cont.activate(cont.actuators['empty'])
|
76
|
|
- if mcam['playback'] == False:
|
77
|
|
- cont.activate(cont.actuators['add_overlay'])
|
78
|
|
- #pass
|
79
|
|
- #printplaying()
|
80
|
|
- cont.activate(cont.actuators['remove_stance'])
|
81
|
|
- cube['camera'] = 2
|
82
|
|
- cube['camnum'] = 2
|
83
|
|
- scene.active_camera = freecam
|
84
|
|
- #print('set freecam', scene.active_camera)
|
85
|
|
- freecam.lens = mcam['focal_length']
|
86
|
|
- freecam.worldPosition = mcam.worldPosition
|
87
|
|
- freecam.worldOrientation = mcam.worldOrientation
|
88
|
|
-
|
89
|
|
- if pause_state == 1:
|
90
|
|
- if mcam['playback'] == False:
|
91
|
|
- layer = 2
|
92
|
|
- if skater.isPlayingAction(layer):
|
93
|
|
- skater.stopAction(layer)
|
94
|
|
- if deck.isPlayingAction(layer):
|
95
|
|
- deck.stopAction(layer)
|
96
|
|
- if trucks.isPlayingAction(layer):
|
97
|
|
- trucks.stopAction(layer)
|
98
|
|
- layer = 3
|
99
|
|
- if skater.isPlayingAction(layer):
|
100
|
|
- skater.stopAction(layer)
|
101
|
|
- if deck.isPlayingAction(layer):
|
102
|
|
- deck.stopAction(layer)
|
103
|
|
- if trucks.isPlayingAction(layer):
|
104
|
|
- trucks.stopAction(layer)
|
105
|
|
- layer = 4
|
106
|
|
- if skater.isPlayingAction(layer):
|
107
|
|
- skater.stopAction(layer)
|
108
|
|
- if deck.isPlayingAction(layer):
|
109
|
|
- deck.stopAction(layer)
|
110
|
|
- if trucks.isPlayingAction(layer):
|
111
|
|
- trucks.stopAction(layer)
|
112
|
|
- menuV3.main(cont)
|
113
|
|
-
|
114
|
|
-
|
115
|
|
-
|
116
|
|
- #exit pause
|
117
|
|
- if pause_state == 0 and last_pause == 1:
|
118
|
|
- #print("unpause")
|
119
|
|
- Settings.writeSettings()
|
120
|
|
- own.restoreDynamics()
|
121
|
|
- #own['camera'] = 0
|
122
|
|
- #own.setlinearVelocity([0,0,0],1]
|
123
|
|
-
|
124
|
|
- if own['walk'] == False:
|
125
|
|
- cont.activate(cont.actuators['roll'])
|
126
|
|
- else:
|
127
|
|
- cont.activate(cont.actuators['walk'])
|
128
|
|
- #print("pre_pause_linvel = ", own['pre_pause_linvel'])
|
129
|
|
- try:
|
130
|
|
- own.setLinearVelocity(own['pre_pause_linvel'], 1)
|
131
|
|
- except:
|
132
|
|
- pass
|
133
|
|
- cont.activate(cont.actuators['remove_overlay'])
|
134
|
|
- cont.activate(cont.actuators['add_stance'])
|
135
|
|
-
|
136
|
|
- if pause_state == 1 and dict['rtsBut'] == False and dict['last_rtsBut'] == True:
|
137
|
|
- scenes = bge.logic.getSceneList()
|
138
|
|
- if 'pause' in scenes:
|
139
|
|
- cont.activate(cont.actuators['remove_overlay'])
|
140
|
|
- else:
|
141
|
|
- cont.activate(cont.actuators['add_overlay'])
|
142
|
|
- #print(pause_state)
|
143
|
|
- dict['last_npause'] = pause_state
|
144
|
|
- #print(scene.active_camera, cube['camera'])
|
145
|
|
-
|
146
|
|
-
|
147
|
|
-main()
|
|
1
|
+import bge
|
|
2
|
+import menuV3
|
|
3
|
+import Settings
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+#replay huds:
|
|
7
|
+#add_hud
|
|
8
|
+#remove_hud (on control_cube)
|
|
9
|
+
|
|
10
|
+def main():
|
|
11
|
+
|
|
12
|
+ cont = bge.logic.getCurrentController()
|
|
13
|
+ scene = bge.logic.getCurrentScene()
|
|
14
|
+ #own = cont.owner
|
|
15
|
+ dictionary = bge.logic.globalDict
|
|
16
|
+
|
|
17
|
+ skater = scene.objects["Char4"]
|
|
18
|
+ deck = scene.objects["deck"]
|
|
19
|
+ trucks = scene.objects["trucks"]
|
|
20
|
+ own = scene.objects["control_cube.002"]
|
|
21
|
+
|
|
22
|
+ camList = scene.cameras
|
|
23
|
+ freecam = camList["freecam"]
|
|
24
|
+ mcam = camList['Camera.003']
|
|
25
|
+
|
|
26
|
+ #freecam = scene.objects['freecam']
|
|
27
|
+ cube = scene.objects['control_cube.002']
|
|
28
|
+
|
|
29
|
+ pause_state = dictionary['npause']
|
|
30
|
+ last_pause = dictionary['last_npause']
|
|
31
|
+
|
|
32
|
+ def printplaying():
|
|
33
|
+ splaying_layers = "S: "
|
|
34
|
+ playing_layers = "D: "
|
|
35
|
+ tplaying_layers = "T: "
|
|
36
|
+ for x in range(1000):
|
|
37
|
+ if skater.isPlayingAction(x):
|
|
38
|
+ #if trucks.isPlayingAction(x):
|
|
39
|
+ #if skater.isPlayingAction(x):
|
|
40
|
+ splaying_layers += str(x)
|
|
41
|
+ splaying_layers += " "
|
|
42
|
+ if deck.isPlayingAction(x):
|
|
43
|
+ #if trucks.isPlayingAction(x):
|
|
44
|
+ #if skater.isPlayingAction(x):
|
|
45
|
+ playing_layers += str(x)
|
|
46
|
+ playing_layers += " "
|
|
47
|
+ if trucks.isPlayingAction(x):
|
|
48
|
+ #if trucks.isPlayingAction(x):
|
|
49
|
+ #if skater.isPlayingAction(x):
|
|
50
|
+ tplaying_layers += str(x)
|
|
51
|
+ tplaying_layers += " "
|
|
52
|
+ print(splaying_layers, playing_layers, tplaying_layers)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+ #switch pause state
|
|
56
|
+ if dictionary['stBut'] == True and dictionary['last_stBut'] == False:
|
|
57
|
+ if pause_state == False:
|
|
58
|
+ pause_state = True
|
|
59
|
+ else:
|
|
60
|
+ pause_state = False
|
|
61
|
+ dictionary['npause'] = pause_state
|
|
62
|
+
|
|
63
|
+ #enter pause
|
|
64
|
+ if pause_state == True and last_pause == False:
|
|
65
|
+ own.suspendDynamics()
|
|
66
|
+ own['pre_pause_linvel'] = [own['linvelx'], own['linVely'], 0]
|
|
67
|
+ own.setLinearVelocity([0,0,0],1)
|
|
68
|
+ cont.activate(cont.actuators['empty'])
|
|
69
|
+ if mcam['playback'] == False:
|
|
70
|
+ cont.activate(cont.actuators['add_overlay'])
|
|
71
|
+ #pass
|
|
72
|
+ #printplaying()
|
|
73
|
+ cont.activate(cont.actuators['remove_stance'])
|
|
74
|
+ cube['camera'] = 2
|
|
75
|
+ cube['camnum'] = 2
|
|
76
|
+ scene.active_camera = freecam
|
|
77
|
+ #print('set freecam', scene.active_camera)
|
|
78
|
+ freecam.lens = mcam['focal_length']
|
|
79
|
+ freecam.worldPosition = mcam.worldPosition
|
|
80
|
+ freecam.worldOrientation = mcam.worldOrientation
|
|
81
|
+
|
|
82
|
+ if pause_state == True:
|
|
83
|
+ if mcam['playback'] == False:
|
|
84
|
+ layer = 2
|
|
85
|
+ if skater.isPlayingAction(layer):
|
|
86
|
+ skater.stopAction(layer)
|
|
87
|
+ if deck.isPlayingAction(layer):
|
|
88
|
+ deck.stopAction(layer)
|
|
89
|
+ if trucks.isPlayingAction(layer):
|
|
90
|
+ trucks.stopAction(layer)
|
|
91
|
+ layer = 3
|
|
92
|
+ if skater.isPlayingAction(layer):
|
|
93
|
+ skater.stopAction(layer)
|
|
94
|
+ if deck.isPlayingAction(layer):
|
|
95
|
+ deck.stopAction(layer)
|
|
96
|
+ if trucks.isPlayingAction(layer):
|
|
97
|
+ trucks.stopAction(layer)
|
|
98
|
+ layer = 4
|
|
99
|
+ if skater.isPlayingAction(layer):
|
|
100
|
+ skater.stopAction(layer)
|
|
101
|
+ if deck.isPlayingAction(layer):
|
|
102
|
+ deck.stopAction(layer)
|
|
103
|
+ if trucks.isPlayingAction(layer):
|
|
104
|
+ trucks.stopAction(layer)
|
|
105
|
+ menuV3.main(cont)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+ #exit pause
|
|
110
|
+ if pause_state == False and last_pause == True:
|
|
111
|
+ #print("unpause")
|
|
112
|
+ Settings.writeSettings()
|
|
113
|
+ own.restoreDynamics()
|
|
114
|
+ #own['camera'] = 0
|
|
115
|
+ #own.setlinearVelocity([0,0,0],1]
|
|
116
|
+
|
|
117
|
+ if own['walk'] == False:
|
|
118
|
+ cont.activate(cont.actuators['roll'])
|
|
119
|
+ else:
|
|
120
|
+ cont.activate(cont.actuators['walk'])
|
|
121
|
+ #print("pre_pause_linvel = ", own['pre_pause_linvel'])
|
|
122
|
+ try:
|
|
123
|
+ own.setLinearVelocity(own['pre_pause_linvel'], 1)
|
|
124
|
+ except:
|
|
125
|
+ pass
|
|
126
|
+ cont.activate(cont.actuators['remove_overlay'])
|
|
127
|
+ cont.activate(cont.actuators['add_stance'])
|
|
128
|
+
|
|
129
|
+ if pause_state == True and dictionary['rtsBut'] == False and dictionary['last_rtsBut'] == True:
|
|
130
|
+ scenes = bge.logic.getSceneList()
|
|
131
|
+ if 'pause' in scenes:
|
|
132
|
+ cont.activate(cont.actuators['remove_overlay'])
|
|
133
|
+ else:
|
|
134
|
+ cont.activate(cont.actuators['add_overlay'])
|
|
135
|
+ #print(pause_state)
|
|
136
|
+ dictionary['last_npause'] = pause_state
|
|
137
|
+ #print(scene.active_camera, cube['camera'])
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+main()
|