Exemplo n.º 1
0
def remove_component(entity_id):
    try:
        state = forcefields[entity_id]
        if state.active:
            health.set_vurnable(entity_id, True)
    finally:
        del forcefields[entity_id]
Exemplo n.º 2
0
def update(dt):
    stop_me = []
    for entity_id, state in forcefields.iteritems():
        timeout, active = state.timeout, state.active
        timeout -= dt
        if timeout > 0:
            if not active:
                health.set_vurnable(entity_id, False)
                state.active = True
        else:
            stop_me.append(entity_id)
        state.timeout = timeout

    for entity_id in stop_me:
        remove_component(entity_id)