def rGetObjects(self, parentObj, subObjs, finalObjs, objType):
        for i in subObjs:
            data = subObjs[i]
            levelObj = LevelObject(i, data)
            levelObj.transform = parentObj.transform.compose(levelObj.transform)
            objList = data.get('Objects')
            if objList:
                self.rGetObjects(levelObj, objList, finalObjs, objType)

            if objType == data.get('Type'):
                finalObjs.append(levelObj)
                continue
Exemple #2
0
    def rGetObjects(self, parentObj, subObjs, finalObjs, objType):
        for i in subObjs:
            data = subObjs[i]
            levelObj = LevelObject(i, data)
            levelObj.transform = parentObj.transform.compose(
                levelObj.transform)
            objList = data.get('Objects')
            if objList:
                self.rGetObjects(levelObj, objList, finalObjs, objType)

            if objType == data.get('Type'):
                finalObjs.append(levelObj)
                continue
Exemple #3
0
 def loadFileObject(self, filename, gameArea):
     fileData = self.openFile(filename)
     self.fileDicts[filename] = fileData
     fileObjUid = fileData['Objects'].keys()[0]
     fileObj = LevelObject(fileObjUid, fileData)
     self.fileObjs[fileObjUid] = fileObj
     self.loadObj(fileObj, gameArea)
 def registerFileObject(self, filename):
     fileData = self.openFile(filename)
     self.fileDicts[filename] = fileData
     fileObjUid = fileData['Objects'].keys()[0]
     self.storeNecessaryAreaData(fileObjUid, fileData)
     self.fileObjs[fileObjUid] = LevelObject(fileObjUid, fileData['Objects'][fileObjUid])
     self.registerSubObj(self.fileObjs[fileObjUid])
Exemple #5
0
 def loadTemplateObject(self, filename, gameArea, rootTransform):
     fileData = self.openFile(filename)
     fileObjUid = fileData['Objects'].keys()[0]
     fileObj = self.getObject(LevelObject(fileObjUid, fileData), fileObjUid)
     fileObj.transform = rootTransform.compose(fileObj.transform)
     for objKey in fileObj.data.get('Objects', []):
         obj = self.getObject(fileObj, objKey)
         obj.transform = fileObj.transform.compose(obj.transform)
         self.loadObj(obj, gameArea)
 def getObjectsOfType(self, uid, objType):
     finalObjs = []
     data = self.getObjectDataByUid(uid, None)
     objRoot = LevelObject(uid, data)
     self.rGetObjects(objRoot, data.get('Objects', []), finalObjs, objType)
     fileName = data.get('File')
     if fileName:
         fileDict = self.openFile(fileName + '.py')
         self.rGetObjects(objRoot, fileDict.get('Objects', []), finalObjs, objType)
     
     return finalObjs
Exemple #7
0
 def getObject(self, parentObj, key):
     data = parentObj.data['Objects'].get(key)
     if data:
         return LevelObject(key, data)