示例#1
1
文件: gunit.py 项目: onze/goLive
 def __init__(self,conf):
    GEntity.__init__(self,conf)
    self.p3dobject.reparentTo(self.gmap.units_node)
    self.p3dobject.setTransparency(TransparencyAttrib.MAlpha)
    #to be put under condition for non pickable units (bonuses npc for instance)
    self.p3dobject.setTag('GUnit-pickable','1')
    self.p3dobject.setPos(self.gmap.root.find('**/tile_'+str(conf['tileid'])),0,0,0)
    #supposedly already a float, but will screw up if not, so just making sure.
    self.move_speed=float(conf['move_speed'])
    self.path=[]
    self.popout_when_move_over=False
    self.pid=conf['pid']
    #highlight
    self.ts_highlighted=TextureStage('ts_highlighted')
    self.ts_highlighted.setMode(TextureStage.MDecal)
    self.ts_highlighted.setSort(2)
    #highlight
    self.ts_selected=TextureStage('ts_selected')
    self.ts_selected.setMode(TextureStage.MDecal)
    self.ts_selected.setSort(3)
示例#2
0
文件: gtile.py 项目: onze/goLive
 def __init__(self,conf):
    self.p3dobject=self.gmap.tile_matrix_node.attachNewNode('tile_'+str(conf['eid']))
    self.p3dobject.setTransparency(TransparencyAttrib.MAlpha)
    #self.test_sphere=loader.loadModel('data/models/test_sphere.egg')
    #self.test_sphere.reparentTo(self.p3dobject)
    GEntity.__init__(self,conf)
    self.x,self.y=x,y=conf['x'],conf['y']
    self.p3dobject.setTag('x',str(x))
    self.p3dobject.setTag('y',str(y))
    self.p3dobject.setPythonTag('ref',self)
    #half of a tile side
    t=self.gmap.tile_matrix_node.getScale()[0]/2.
    self.p3dobject.setPos(self.gmap.tile_matrix_node,(-self.gmap.resx/2.+x+t)*2.,(y-self.gmap.resy/2.+t)*2.,0)
    #preload texture holder quad
    self.quad=GTile.resources['quad']()
    self.quad.setTransparency(TransparencyAttrib.MAlpha)
    #self.quad.reparentTo(self.p3dobject)
    self.quad.reparentTo(self.gmap.tiles_quads_node)
    self.quad.setPos(self.p3dobject.getPos())
    self.quad.hide()
    
    #pid of the player that owns the tile
    self.pawner=None
    self.ts_pawn=TextureStage('ts_pawn')
    self.ts_pawn.setMode(TextureStage.MReplace)
    self.ts_pawn.setSort(2)
    
    #selection
    self.is_selected=False
    self.ts_selected=TextureStage('ts_selected')
    self.ts_selected.setMode(TextureStage.MReplace)
    self.ts_selected.setSort(3)
    
    #highlight
    self.is_highlighted=False
    self.ts_highlighted=TextureStage('ts_highlighted')
    self.ts_highlighted.setMode(TextureStage.MDecal)
    self.ts_highlighted.setSort(4)
示例#3
0
文件: gunit.py 项目: onze/goLive
 def dispose(self):
    '''del method'''
    GEntity.dispose(self)
    self.popout_sequence.finish()
    del self.popout_sequence