using UnityEngine;

public class Chase : MonoBehaviour 
{
    private MoveController move;

    void Start()
    {
        move = GetComponent<MoveController>();
    }

    void Attack(Transform target)
    {
        MoveToTarget(target.position);
    }

    void Search(Vector2 location)
    {
        MoveToTarget(location);
    }

    void Stop()
    {
        move.MoveDir = Vector2.zero;
    }

    private void MoveToTarget(Vector3 target)
    {
        Vector2 delta = (target - transform.position);
        move.MoveDir = delta.normalized;
    }
}
