Package transientlibs.preui.agents.factories

Source Code of transientlibs.preui.agents.factories.GDXCreatureFactory

/*
* 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;
       

    }
   
}
TOP

Related Classes of transientlibs.preui.agents.factories.GDXCreatureFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.