ソースを参照

starting bossBattle

David Rose 22 年 前
コミット
1fd98e38f1
1 ファイル変更18 行追加0 行削除
  1. 18 0
      direct/src/distributed/DistributedObject.py

+ 18 - 0
direct/src/distributed/DistributedObject.py

@@ -52,6 +52,9 @@ class DistributedObject(PandaObject):
             # These are used by getCallbackContext() and doCallbackContext().
             # These are used by getCallbackContext() and doCallbackContext().
             self.__nextContext = 0
             self.__nextContext = 0
             self.__callbacks = {}
             self.__callbacks = {}
+
+            # This is used by doneBarrier().
+            self.__barrierContext = None
             
             
         return None
         return None
 
 
@@ -291,3 +294,18 @@ class DistributedObject(PandaObject):
         else:
         else:
             self.notify.warning("Got unexpected context from AI: %s" % (context))
             self.notify.warning("Got unexpected context from AI: %s" % (context))
         
         
+    def doBarrierWait(self, context):
+        # This message is sent by the AI to tell us the context number
+        # for the current barrier.  When the client is done handling
+        # whatever it should handle in its current state, it should
+        # call doneBarrier(), which will send the context number back
+        # to the AI.
+        self.__barrierContext = context
+        
+    def doneBarrier(self):
+        # Tells the AI we have finished handling our task.
+        assert(self.__barrierContext != None)
+        self.sendUpdate("doBarrierReady", [self.__barrierContext])
+        self.__barrierContext = None
+        
+