/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package transientlibs.preui.agents.factories;
import transientlibs.slick2d.util.Log;
import transientlibs.bindedobjects.gamecontent.Cards;
import transientlibs.objects.cards.Deck;
import transientlibs.processors.misc.Detonator;
import transientlibs.maps.implementation.TilelessMap;
import transientlibs.maps.units.GenericUnit;
import transientlibs.maps.units.GDXUnit;
/**
*
* @author kibertoad
*/
public class GDXCreatureFactory extends AbstractCreatureFactory{
@Override
public GenericUnit produceUnit(int creatureID, int onX, int onY, TilelessMap onMap) {
GenericUnit newUnit;
newUnit = new GDXUnit(onX, onY, creatureID, onMap);
if (onMap != null) {
onMap.placeUnit(onX, onY, newUnit);
Log.info("PLACED UNIT");
} else {
Log.warn("No map!");
}
if (Detonator.INSTANCE.useGDXImages) {
newUnit.setImage(newUnit.getCreatures().masterImage);
}
if (newUnit.getCreatures().cards != null) {
//Log.info("DECK TIME");
newUnit.setDeck (new Deck());
for (Cards c : newUnit.getCreatures().cards) {
newUnit.getDeck().addCard(c);
}
}
return newUnit;
}
}