package space_invaders.managers;

import space_invaders.characters.AnimatedEnemy;
import space_invaders.characters.SimpleEnemy;
import space_invaders.images.AnimationsMaker;
import space_invaders.images.Images;
import space_invaders.interfaces.Enemy;
import space_invaders.structure.Constants;
import space_invaders.structure.immutables.Point;
import space_invaders.structure.immutables.Size;

// factory that creates enemies from specified type
public class EnemyFactory
{
    public static final class ENEMY_TYPES
    {
        // in levels.xml enemy type is represented by right-side value
        // BASIC = "b"
        public static final String ANIMATED = "a";
    }

    public static Enemy getEnemy(String type, Point point, Size size)
    {
        if (ENEMY_TYPES.ANIMATED.equals(type))
            return new AnimatedEnemy(point,
                    size,
                    Constants.SHOOT_CHANCE_INCREASE,
                    AnimationsMaker.getInstance().getNewEnemyAnimation()
                    );
        return new SimpleEnemy(point,
                size,
                Images.CRAB_GREEN_0,
                Constants.SHOOT_CHANCE_INCREASE
        );
    }
}