示例#1
0
class Player:
    def __init__(self,sock,address,parent,name):

        self.name = name
        self.parent = parent

        self.logic = Logic(self)
        self.client = Client(self,sock,address)                      
        self.object = Physics([1,1,1],[0,0,0],[[1,0,0],[0,1,0],[0,0,1]])
        self.camera = Physics([1,1,1],[0,0,0],[[0,-1,0],[0,0,1],[-1,0,0]])
        
        self.parent.objects.append(self.name,(self.object.scale,self.object.position,self.object.orientation))
        self.parent.cameras.append(self.name,(self.camera.scale,self.camera.position,self.camera.orientation))

    def sync(self):
        self.parent.objects.update(self.name,(self.object.scale,self.object.position,self.object.orientation))
        self.parent.cameras.update(self.name,(self.camera.scale,self.camera.position,self.camera.orientation))

    def close(self):
        self.parent.delObject(self.name)

    def main(self):
        self.sync()
        self.logic.main()
        self.client.main()
示例#2
0
    def __init__(self,sock,address,parent,name):

        self.name = name
        self.parent = parent

        self.logic = Logic(self)
        self.client = Client(self,sock,address)                      
        self.object = Physics([1,1,1],[0,0,0],[[1,0,0],[0,1,0],[0,0,1]])
        self.camera = Physics([1,1,1],[0,0,0],[[0,-1,0],[0,0,1],[-1,0,0]])
        
        self.parent.objects.append(self.name,(self.object.scale,self.object.position,self.object.orientation))
        self.parent.cameras.append(self.name,(self.camera.scale,self.camera.position,self.camera.orientation))