コード例 #1
0
 def add(self, object):
     """Adds an object to the list, notify observers."""
     if PyUtils.sameObjectInList(object, self._objects) :
         raise KeyError ('Cannot add the same object twice to application.')
     self._objects.append( object )
     self.notifyObservers()
     return object
コード例 #2
0
 def addCharacter(self, character):
     """Adds a character to the application and the world"""
     import Physics
     if PyUtils.sameObjectInList(character, self._characters) :
         raise KeyError ('Cannot add the same character twice to application.')
     Physics.world().addArticulatedFigure( character )
     self._characters.append( character )
     if self._followedCharacter is None :
         self._followedCharacter = character
         self._cameraFollowCharacter = True
         self._cameraObservable.notifyObservers()
     self._characterObservable.notifyObservers()
コード例 #3
0
 def addCharacter(self, character):
     """Adds a character to the application and the world"""
     import Physics
     if PyUtils.sameObjectInList(character, self._characters):
         raise KeyError(
             'Cannot add the same character twice to application.')
     Physics.world().addArticulatedFigure(character)
     self._characters.append(character)
     if self._followedCharacter is None:
         self._followedCharacter = character
         self._cameraFollowCharacter = True
         self._cameraObservable.notifyObservers()
     self._characterObservable.notifyObservers()