Browse Source

more pumps

shuvit 5 years ago
parent
commit
76d5884337
3 changed files with 77 additions and 45 deletions
  1. 10
    0
      aiRecord.py
  2. 10
    29
      ai_manager.py
  3. 57
    16
      co_ActionState.py

+ 10
- 0
aiRecord.py View File

128
         name2, orientation = readData.returnOrientation(objIndex, valueIndex, own)
128
         name2, orientation = readData.returnOrientation(objIndex, valueIndex, own)
129
         try:
129
         try:
130
             if own['rpStartLoc_set'] == False:
130
             if own['rpStartLoc_set'] == False:
131
+                
132
+                
133
+                
131
                 own['rpStartLoc'] = position
134
                 own['rpStartLoc'] = position
132
                 print('setting npc_start_pos', position)
135
                 print('setting npc_start_pos', position)
133
                 
136
                 
156
                 cube.worldPosition = position
159
                 cube.worldPosition = position
157
                 deck.worldPosition = position
160
                 deck.worldPosition = position
158
                 trucks.worldPosition = position
161
                 trucks.worldPosition = position
162
+                
163
+            if 'data_loaded' not in own:
164
+                own['data_loaded'] = 1 
165
+                cube.worldPosition = position
166
+                deck.worldPosition = position
167
+                trucks.worldPosition = position                   
168
+                
159
         except:
169
         except:
160
             print('npc positioning not working')
170
             print('npc positioning not working')
161
             #pass
171
             #pass

+ 10
- 29
ai_manager.py View File

16
           
16
           
17
     print(splaying_layers, playing_layers)
17
     print(splaying_layers, playing_layers)
18
 
18
 
19
-
20
-
21
-
22
 def main():
19
 def main():
23
 
20
 
24
     frame_rate = 60    #Set this to the framerate of your game.
21
     frame_rate = 60    #Set this to the framerate of your game.
35
     from mathutils import Vector
32
     from mathutils import Vector
36
     import math
33
     import math
37
     
34
     
35
+    debugg = True
38
 
36
 
39
     cont = logic.getCurrentController()
37
     cont = logic.getCurrentController()
40
     own = cont.owner
38
     own = cont.owner
41
     scene = logic.getCurrentScene()
39
     scene = logic.getCurrentScene()
42
     dict = logic.globalDict
40
     dict = logic.globalDict
43
-    own['valueIndex'] = own['valueIndex'] + 20
41
+    own['valueIndex'] = own['valueIndex'] + 2
44
     #dict['recorder_on'] = recorder_on
42
     #dict['recorder_on'] = recorder_on
45
     npc_index = own['npc_index']
43
     npc_index = own['npc_index']
46
     skater = dict['spawned_npcs'][npc_index]
44
     skater = dict['spawned_npcs'][npc_index]
51
     recording_cutoff = own['replay_length']
49
     recording_cutoff = own['replay_length']
52
     idle_timer = own['idle_timer']
50
     idle_timer = own['idle_timer']
53
     npc_playback = own['npc_playback']
51
     npc_playback = own['npc_playback']
52
+    
53
+    
54
+    
54
     if 'data_loaded' not in own:
55
     if 'data_loaded' not in own:
55
-        own['data_loaded'] = 1
56
+        #own['data_loaded'] = 1
56
         aiRecord.loadData(cont, own)
57
         aiRecord.loadData(cont, own)
58
+        if debugg: print('ai_loadData')
59
+        
57
     if npc_playback == True:
60
     if npc_playback == True:
58
         cube = own
61
         cube = own
59
         aiRecord.loadData(cont, own)   
62
         aiRecord.loadData(cont, own)   
68
             own['objIndex'] = own['objIndex'] + 2
71
             own['objIndex'] = own['objIndex'] + 2
69
         else:
72
         else:
70
             own['objIndex'] = 4   
73
             own['objIndex'] = 4   
71
-            print('replay end') 
72
-#            try:
73
-#                tActu = cont.actuators['npcSteering']
74
-#                cont.deactivate(tActu)
75
-
76
-#                
77
-#            except:
78
-#                print('no target to delete')    
74
+            print('replay end')    
79
             npcChangeAnim.main(cont)
75
             npcChangeAnim.main(cont)
80
             #own['npc_replay_name'] = '30secA.dat'
76
             #own['npc_replay_name'] = '30secA.dat'
81
             own['inited'] = False
77
             own['inited'] = False
89
             #print('idling', idle_timer)
85
             #print('idling', idle_timer)
90
         else:
86
         else:
91
             idle_timer = 0
87
             idle_timer = 0
92
-            own['npc_rotate'] = True 
93
-#    if own['npc_rotate'] == True:
94
-#        xyz = own.localOrientation.to_euler()
95
-#        rotz = math.degrees(xyz[2])
96
-#        print (rotz, own['rpStartZ'], '---rotations')
97
-#        num = rotz - own['rpStartZ']
98
-#        amt = .05
99
-#        amt2 = 2
100
-#        if abs(num) < amt2:
101
-#            own['npc_playback'] = True
102
-#            own['npc_rotate'] = False
103
-#            print('----starting replay', num)
104
-#        elif rotz > own['rpStartZ']:
105
-#            own.applyRotation([0,0,-amt], True)
106
-#        elif rotz < own['rpStartZ']:
107
-#            own.applyRotation([0,0,amt], True)                 
88
+            own['npc_rotate'] = True                 
108
             
89
             
109
     if own['move'] == True:
90
     if own['move'] == True:
110
         speed = .15
91
         speed = .15

+ 57
- 16
co_ActionState.py
File diff suppressed because it is too large
View File


Loading…
Cancel
Save