/** * Unsubscribes the passed element from all the interactions it was subscribed * And also passes the element to the "Remove List" * Objects in the remove list are removed removed next time the cleanRemoveList() method is called. * Normally that is called after the end of each step * */ public void postDestroyed(ElementBase element) { this.toBeRemoved.add(element); if(element instanceof InteractionCallbacks) { for(InteractionBase interaction: interactions) interaction.unSubscribe((InteractionCallbacks) element); for(InteractionBase gameControlInteraction: gameControlInteractions) gameControlInteraction.unSubscribe((InteractionCallbacks) element); } }
public void unSubscribeToControllingInteraction(InteractionCallbacks subscriber, Class<? extends InteractionBase> interaction) { for(InteractionBase i: gameControlInteractions) { if(i.getClass() == interaction) { i.unSubscribe(subscriber); return; } } }