// Path: core/src/me/minidigger/projecttd/components/MinionComponent.java
// public class MinionComponent implements Component, Pool.Poolable {
// 
//     public int money = 1;
//     public float speed = 1f;
//     public Minion.MinionType type = Minion.MinionType.LAND;
//     public int points = 10;
// 
//     @Override
//     public void reset() {
//         money = 1;
//         speed = 1f;
//         type = Minion.MinionType.LAND;
//         points = 10;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/components/PathComponent.java
// public class PathComponent implements Component, Pool.Poolable {
// 
//     public int tilesToGoal = -1;
//     public Vector2 nextPoint;
//     public PathFindingSystem.GoalReachedAction completed = (e) -> {
//     };
// 
//     @Override
//     public void reset() {
//         tilesToGoal = -1;
//         nextPoint = null;
//         completed = (e) -> {
//         };
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/components/TransformComponent.java
// public class TransformComponent implements Component, Pool.Poolable {
// 
//     public Vector2 position;
//     public float rotation = 0f;
// 
//     @Override
//     public void reset() {
//         position = new Vector2();
//         rotation = 0f;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/components/VelocityComponent.java
// public class VelocityComponent implements Component, Pool.Poolable {
// 
//     public Vector2 linear = new Vector2();
//     public float angular = 0f;
// 
//     @Override
//     public void reset() {
//         linear = new Vector2();
//         angular = 0f;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/entities/Minion.java
// public class Minion {
// 
//     public static PooledEngine ENGINE;
//     public static Sprite SPRITE;
// 
//     public static Entity newMinion(Vector2 spawn) {
//         Entity entity = ENGINE.createEntity();
// 
//         SpriteComponent spriteComponent = ENGINE.createComponent(SpriteComponent.class);
//         spriteComponent.sprite = SPRITE;
//         entity.add(spriteComponent);
// 
//         VelocityComponent velocityComponent = ENGINE.createComponent(VelocityComponent.class);
//         entity.add(velocityComponent);
// 
//         TransformComponent transformComponent = ENGINE.createComponent(TransformComponent.class);
//         transformComponent.position = spawn;
//         entity.add(transformComponent);
// 
//         HealthComponent healthComponent = ENGINE.createComponent(HealthComponent.class);
//         healthComponent.health = 100;
//         entity.add(healthComponent);
// 
//         PathComponent pathComponent = ENGINE.createComponent(PathComponent.class);
//         entity.add(pathComponent);
// 
//         MinionComponent minionComponent = ENGINE.createComponent(MinionComponent.class);
//         entity.add(minionComponent);
// 
//         ENGINE.addEntity(entity);
//         return entity;
//     }
// 
//     public enum MinionType{
//         LAND,
//         WATER,
//         AIR;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/utils/VectorUtil.java
// public class VectorUtil {
// 
//     // returns radians
//     public static float vectorToAngle(Vector2 vector) {
//         return (float) Math.atan2(-vector.x, vector.y);
//     }
// 
//     // angle = radians
//     public static Vector2 angleToVector(Vector2 outVector, float angle) {
//         outVector.x = -(float) Math.sin(angle);
//         outVector.y = (float) Math.cos(angle);
//         return outVector;
//     }
// }


import com.badlogic.ashley.core.ComponentMapper;
import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.systems.IteratingSystem;
import com.badlogic.gdx.ai.utils.ArithmeticUtils;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import me.minidigger.projecttd.components.MinionComponent;
import me.minidigger.projecttd.components.PathComponent;
import me.minidigger.projecttd.components.TransformComponent;
import me.minidigger.projecttd.components.VelocityComponent;
import me.minidigger.projecttd.entities.Minion;
import me.minidigger.projecttd.utils.VectorUtil;
package me.minidigger.projecttd.systems;



/**
 * Created by Martin on 07.04.2017.
 */
public class MoveToSystem extends IteratingSystem {

    private ComponentMapper<TransformComponent> pm = ComponentMapper.getFor(TransformComponent.class);
    private ComponentMapper<VelocityComponent> vm = ComponentMapper.getFor(VelocityComponent.class);
    private ComponentMapper<PathComponent> pathM = ComponentMapper.getFor(PathComponent.class);
// Path: core/src/me/minidigger/projecttd/components/MinionComponent.java
// public class MinionComponent implements Component, Pool.Poolable {
// 
//     public int money = 1;
//     public float speed = 1f;
//     public Minion.MinionType type = Minion.MinionType.LAND;
//     public int points = 10;
// 
//     @Override
//     public void reset() {
//         money = 1;
//         speed = 1f;
//         type = Minion.MinionType.LAND;
//         points = 10;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/components/PathComponent.java
// public class PathComponent implements Component, Pool.Poolable {
// 
//     public int tilesToGoal = -1;
//     public Vector2 nextPoint;
//     public PathFindingSystem.GoalReachedAction completed = (e) -> {
//     };
// 
//     @Override
//     public void reset() {
//         tilesToGoal = -1;
//         nextPoint = null;
//         completed = (e) -> {
//         };
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/components/TransformComponent.java
// public class TransformComponent implements Component, Pool.Poolable {
// 
//     public Vector2 position;
//     public float rotation = 0f;
// 
//     @Override
//     public void reset() {
//         position = new Vector2();
//         rotation = 0f;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/components/VelocityComponent.java
// public class VelocityComponent implements Component, Pool.Poolable {
// 
//     public Vector2 linear = new Vector2();
//     public float angular = 0f;
// 
//     @Override
//     public void reset() {
//         linear = new Vector2();
//         angular = 0f;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/entities/Minion.java
// public class Minion {
// 
//     public static PooledEngine ENGINE;
//     public static Sprite SPRITE;
// 
//     public static Entity newMinion(Vector2 spawn) {
//         Entity entity = ENGINE.createEntity();
// 
//         SpriteComponent spriteComponent = ENGINE.createComponent(SpriteComponent.class);
//         spriteComponent.sprite = SPRITE;
//         entity.add(spriteComponent);
// 
//         VelocityComponent velocityComponent = ENGINE.createComponent(VelocityComponent.class);
//         entity.add(velocityComponent);
// 
//         TransformComponent transformComponent = ENGINE.createComponent(TransformComponent.class);
//         transformComponent.position = spawn;
//         entity.add(transformComponent);
// 
//         HealthComponent healthComponent = ENGINE.createComponent(HealthComponent.class);
//         healthComponent.health = 100;
//         entity.add(healthComponent);
// 
//         PathComponent pathComponent = ENGINE.createComponent(PathComponent.class);
//         entity.add(pathComponent);
// 
//         MinionComponent minionComponent = ENGINE.createComponent(MinionComponent.class);
//         entity.add(minionComponent);
// 
//         ENGINE.addEntity(entity);
//         return entity;
//     }
// 
//     public enum MinionType{
//         LAND,
//         WATER,
//         AIR;
//     }
// }
// 
// Path: core/src/me/minidigger/projecttd/utils/VectorUtil.java
// public class VectorUtil {
// 
//     // returns radians
//     public static float vectorToAngle(Vector2 vector) {
//         return (float) Math.atan2(-vector.x, vector.y);
//     }
// 
//     // angle = radians
//     public static Vector2 angleToVector(Vector2 outVector, float angle) {
//         outVector.x = -(float) Math.sin(angle);
//         outVector.y = (float) Math.cos(angle);
//         return outVector;
//     }
// }


// Path: core/src/me/minidigger/projecttd/systems/MoveToSystem.java
import com.badlogic.ashley.core.ComponentMapper;
import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.Family;
import com.badlogic.ashley.systems.IteratingSystem;
import com.badlogic.gdx.ai.utils.ArithmeticUtils;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import me.minidigger.projecttd.components.MinionComponent;
import me.minidigger.projecttd.components.PathComponent;
import me.minidigger.projecttd.components.TransformComponent;
import me.minidigger.projecttd.components.VelocityComponent;
import me.minidigger.projecttd.entities.Minion;
import me.minidigger.projecttd.utils.VectorUtil;

package me.minidigger.projecttd.systems;



/**
 * Created by Martin on 07.04.2017.
 */
public class MoveToSystem extends IteratingSystem {

    private ComponentMapper<TransformComponent> pm = ComponentMapper.getFor(TransformComponent.class);
    private ComponentMapper<VelocityComponent> vm = ComponentMapper.getFor(VelocityComponent.class);
    private ComponentMapper<PathComponent> pathM = ComponentMapper.getFor(PathComponent.class);
    private ComponentMapper<MinionComponent> minionM = ComponentMapper.getFor(MinionComponent.class);