
ch.sahits.game.openpatrician.engine.land.CaptainEngine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenPatricianEngine Show documentation
Show all versions of OpenPatricianEngine Show documentation
Engine part driving the models and the game
package ch.sahits.game.openpatrician.engine.land;
import ch.sahits.game.event.data.ClockTickDayChange;
import ch.sahits.game.openpatrician.annotation.ClassCategory;
import ch.sahits.game.openpatrician.annotation.EClassCategory;
import ch.sahits.game.openpatrician.annotation.LazySingleton;
import ch.sahits.game.openpatrician.engine.AbstractEngine;
import ch.sahits.game.openpatrician.model.Date;
import ch.sahits.game.openpatrician.model.people.impl.CaptainsState;
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.Subscribe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
/**
* Engine controling all the roaming captains.
* @author Andi Hotz, (c) Sahits GmbH, 2013
* Created on Jan 19, 2013
*
*/
@LazySingleton
@ClassCategory(EClassCategory.SINGLETON_BEAN)
public class CaptainEngine extends AbstractEngine {
@Autowired
private Date date;
@Autowired
private CaptainsState captainsState;
@Autowired
@Qualifier("serverEventBus")
private AsyncEventBus serverEventBus;
@PostConstruct
public void init() {
serverEventBus.register(this);
}
@PreDestroy
private void unregister() {
serverEventBus.unregister(this);
}
@Subscribe
public void handleDayChange(ClockTickDayChange event) {
// TODO check all captains if they have to move on
}
@Override
public List getChildren() {
return newArrayList();
}
// TODO remove captain from the list (retirement)
// TODO add captain to the list if one was retired
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy