コード例 #1
0
ファイル: unit.py プロジェクト: onze/goLive
 def dispose(self):
    Entity.dispose(self)
    print 'Unit.__del__()'
    self.owner=None
    self.tile=None
    self.path=[]
    self.target_path=[]
コード例 #2
0
ファイル: unit.py プロジェクト: onze/goLive
 def __init__(self,player):
    Entity.__init__(self)
    self.owner=player
    self.current_tile=self.owner.home.tile
    #player the unit belongs to. can be none if the unit is neutral
    #data related to moves
    '''list of Tiles to pass by (every tiles). see update_path_following for details.'''
    self.path=[]
    '''list of target tiles (does't change until next target is reached)'''
    self.target_path=[]
    self.x,self.y=self.tile.x,self.tile.y
    self.move_speed=.05
    #when set to true, the unit will mark tiles on its way
    self.is_marking=False
    self.send(self.confirmation_msg)
コード例 #3
0
 def InitShops(self, count):
     shops = []
     for i in range(0, count):
         shop = Entity(["id", "name", "lat", "lng"],
                       ["id", "name", "lat", "lng"])
         product = Entity(
             ["id", "shop_id", "title",
              str(i), "1"],
             ["id", "shop_id", "title", "popularity", "quantity"])
         shop.products = SortedListWithKey(
             key=lambda val: -1 * float(val.popularity))
         shop.products.add(product)
         if i % 2 == 0:
             shop.tags = set(["tag1", "tag2"])
         else:
             shop.tags = set(["taga", "tagb"])
         shops.append(shop)
     return shops