コード例 #1
0
ファイル: timer.py プロジェクト: andie23/_Puzzled
 def _addInstance(self):
     log.debug("Creating timer instance %s", self.id)
     obj = ObjProperties()
     idleInstanceList = obj.getPropObjGroup('timer_instance', self.scene, 0)
     idleInstanceObj = idleInstanceList[0]
     idleInstanceObj['instance_id'] = self.id
     self.scene.addObject(idleInstanceObj)
     timerObj = obj.getObjByPropVal('instance_id', self.id,
                                    self.scene.objects)
     return timerObj
コード例 #2
0
    def refreshVsBlocks(self):
        vsBlocks = self.getVisualBlocks()
        lgBlocks = self.getLogicalBlocks()
        obj = ObjProperties()

        for vsBlock in vsBlocks:
            vsBlock.removeParent()
            lgBlock = obj.getObjByPropVal('block_number',
                                          vsBlock['visual_block'], lgBlocks)
            vsBlock.position = lgBlock.position
            vsBlock.setParent(lgBlock, 0, 0)
            lgBlock['_visual_block'] = str(vsBlock)
コード例 #3
0
    def addVisualBlocks(self):
        '''
        This methods loads a visual_block, which is a puzzle block a player will
        see as they interact with the game. The visual blocks are added and parented to
        logical blocks that share the same block_number.
        '''

        logicalBlockObjs = self.getLogicalBlocks()
        inactvObjs = self.scene.objectsInactive

        for logicalBlockObj in logicalBlockObjs:
            obj = ObjProperties()
            logicalBlock = LogicalBlock(logicalBlockObj)
            inactVsBlock = obj.getObjByPropVal('visual_block',
                                               logicalBlock.blockID,
                                               inactvObjs)

            self.scene.addObject(inactVsBlock, logicalBlockObj, 0)
            actVsBlock = obj.getObjByPropVal('visual_block',
                                             logicalBlock.blockID,
                                             self.scene.objects)
            actVsBlock.position = logicalBlockObj.position
            actVsBlock.setParent(logicalBlockObj, 0, 0)
            logicalBlock.setVsBlock(str(actVsBlock))