Exemple #1
0
    def action_cancel( self, event ):
        self.delete( None )

        manager.restore_default()
        manager.update_current( unit.Unit.active().active_listeners )

        return False
Exemple #2
0
    def activate_next( cls ):
        cls.units.rotate(1)

        cls.end_of_turn -= 1
        #print cls.end_of_turn
        if cls.end_of_turn <= 0:
            end_turn( None )
            cls.end_of_turn = len( cls.units )

        manager.restore_default()
        manager.update_current( cls.active().active_listeners )
Exemple #3
0
    def __init__(self, terrain, executor):
        unit.Unit.__init__(self, terrain)

        self.executor = executor

        self.active_listeners = {event.AI_MOVE: self.action_move}

        manager.restore_default()
        manager.update_current(unit.Unit.active().active_listeners)

        self.wait = 1
Exemple #4
0
    def activate_next( cls, event ):
        cls.units.rotate(1)

        cls.end_of_turn -= 1
        #print cls.end_of_turn
        if cls.end_of_turn <= 0:
            e.Event( e.END_TURN )
            cls.end_of_turn = len( cls.units )

        manager.restore_default()
        manager.update_current( cls.active().active_listeners )
Exemple #5
0
    def __init__( self, terrain, executor ):
        unit.Unit.__init__( self, terrain )

        self.active_listeners = {
            pygame.K_s:         self.action_seed,
            pygame.K_t:         self.action_thorns,
            pygame.K_p:         self.action_poison,
            pygame.K_BACKSPACE: self.action_cancel
        }

        self.executor = executor

        manager.restore_default()
        manager.update_current( unit.Unit.active().active_listeners )
Exemple #6
0
    def __init__(self, terrain, executor):
        unit.Unit.__init__(self, terrain)

        self.active_listeners = manager.init_listener()
        self.active_listeners.update(
            [
                (e.FLOWER_SEED, self.action_seed),
                (e.FLOWER_THORN, self.action_thorns),
                (e.FLOWER_POISON, self.action_poison),
                (e.FLOWER_CANCEL, self.action_cancel),
            ]
        )

        self.executor = executor

        manager.restore_default()
        manager.update_current(unit.Unit.active().active_listeners)
Exemple #7
0
def init():
    import flower
    import rabbit

    all_terrain = t.all()

    random.shuffle( all_terrain )


    for i in range( 5 ):
        flower.Flower( all_terrain.pop() )

    for i in range( 10 ):
        rabbit.Rabbit( all_terrain.pop() )

    #Unit.end_of_turn = 2
    manager.restore_default()
    manager.update_current( Unit.active().active_listeners )
Exemple #8
0
    def delete( self, event ):
        self.terrain.remove_unit( self )
        Unit.units.remove( self )

        manager.restore_default()
        manager.update_current( Unit.active().active_listeners )