// Path: core/src/com/ychstudio/ai/astar/Node.java
// public class Node {
// 
//     public final int x;
//     public final int y;
//     public boolean isWall;
//     private final int index;
//     private final Array<Connection<Node>> connections;
// 
//     public Node(AStarMap map, int x, int y) {
//         this.x = x;
//         this.y = y;
//         this.index = x * map.getHeight() + y;
//         this.isWall = false;
//         this.connections = new Array<Connection<Node>>();
//     }
// 
//     public int getIndex () {
//         return index;
//     }
// 
//     public Array<Connection<Node>> getConnections () {
//         return connections;
//     }
// 
//     @Override
//     public String toString() {
//         return "Node: (" + x + ", " + y + ")";
//     }
// 
// }
// 
// Path: core/src/com/ychstudio/components/GhostComponent.java
// public class GhostComponent implements Component {
// 
//     // state
//     public static final int MOVE_UP = 0;
//     public static final int MOVE_DOWN = 1;
//     public static final int MOVE_LEFT = 2;
//     public static final int MOVE_RIGHT = 3;
//     public static final int ESCAPE = 4;
//     public static final int DIE = 5;
// 
//     public static final float WEAK_TIME = 10f;
//     public float weak_time;
// 
//     public GhostAgent ghostAgent;
// 
//     private final Body body;
// 
//     public int currentState;
// 
//     public boolean weaken;
//     public int hp;
// 
//     public GhostComponent(Body body) {
//         this.body = body;
//         ghostAgent = new GhostAgent(this);
//         ghostAgent.stateMachine.setInitialState(GhostState.MOVE_UP);
//         currentState = MOVE_UP;
//         weaken = false;
//         hp = 1;
//     }
// 
//     public Body getBody() {
//         return body;
//     }
// 
//     public void respawn() {
//         hp = 1;
//         weaken = false;
//     }
// }


import com.badlogic.gdx.ai.fsm.DefaultStateMachine;
import com.badlogic.gdx.ai.fsm.StateMachine;
import com.badlogic.gdx.ai.msg.Telegram;
import com.badlogic.gdx.ai.msg.Telegraph;
import com.badlogic.gdx.math.Vector2;
import com.ychstudio.ai.astar.Node;
import com.ychstudio.components.GhostComponent;
package com.ychstudio.ai.fsm;


public class GhostAgent implements Telegraph {

    public StateMachine<GhostAgent, GhostState> stateMachine;

    public GhostComponent ghostComponent;

    public float speed = 2.4f;

    public float timer;

    public Node nextNode; // for pursue or escape

// Path: core/src/com/ychstudio/ai/astar/Node.java
// public class Node {
// 
//     public final int x;
//     public final int y;
//     public boolean isWall;
//     private final int index;
//     private final Array<Connection<Node>> connections;
// 
//     public Node(AStarMap map, int x, int y) {
//         this.x = x;
//         this.y = y;
//         this.index = x * map.getHeight() + y;
//         this.isWall = false;
//         this.connections = new Array<Connection<Node>>();
//     }
// 
//     public int getIndex () {
//         return index;
//     }
// 
//     public Array<Connection<Node>> getConnections () {
//         return connections;
//     }
// 
//     @Override
//     public String toString() {
//         return "Node: (" + x + ", " + y + ")";
//     }
// 
// }
// 
// Path: core/src/com/ychstudio/components/GhostComponent.java
// public class GhostComponent implements Component {
// 
//     // state
//     public static final int MOVE_UP = 0;
//     public static final int MOVE_DOWN = 1;
//     public static final int MOVE_LEFT = 2;
//     public static final int MOVE_RIGHT = 3;
//     public static final int ESCAPE = 4;
//     public static final int DIE = 5;
// 
//     public static final float WEAK_TIME = 10f;
//     public float weak_time;
// 
//     public GhostAgent ghostAgent;
// 
//     private final Body body;
// 
//     public int currentState;
// 
//     public boolean weaken;
//     public int hp;
// 
//     public GhostComponent(Body body) {
//         this.body = body;
//         ghostAgent = new GhostAgent(this);
//         ghostAgent.stateMachine.setInitialState(GhostState.MOVE_UP);
//         currentState = MOVE_UP;
//         weaken = false;
//         hp = 1;
//     }
// 
//     public Body getBody() {
//         return body;
//     }
// 
//     public void respawn() {
//         hp = 1;
//         weaken = false;
//     }
// }


// Path: core/src/com/ychstudio/ai/fsm/GhostAgent.java
import com.badlogic.gdx.ai.fsm.DefaultStateMachine;
import com.badlogic.gdx.ai.fsm.StateMachine;
import com.badlogic.gdx.ai.msg.Telegram;
import com.badlogic.gdx.ai.msg.Telegraph;
import com.badlogic.gdx.math.Vector2;
import com.ychstudio.ai.astar.Node;
import com.ychstudio.components.GhostComponent;

package com.ychstudio.ai.fsm;


public class GhostAgent implements Telegraph {

    public StateMachine<GhostAgent, GhostState> stateMachine;

    public GhostComponent ghostComponent;

    public float speed = 2.4f;

    public float timer;

    public Node nextNode; // for pursue or escape

    public GhostAgent(GhostComponent ghostComponent) {