Jelajahi Sumber

starting bossBattle

David Rose 22 tahun lalu
induk
melakukan
1fd98e38f1
1 mengubah file dengan 18 tambahan dan 0 penghapusan
  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().
             self.__nextContext = 0
             self.__callbacks = {}
+
+            # This is used by doneBarrier().
+            self.__barrierContext = None
             
         return None
 
@@ -291,3 +294,18 @@ class DistributedObject(PandaObject):
         else:
             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
+        
+