Inheritance: MonoBehaviour
        public bool Check()
        {
            agent = controller.GetComponent<AgentLefevre>();
            agent.RefreshTargets();
            // Do sphere cast and detect if there is an enemy bullet in it
            foreach (GameObject obj in agent.targets)
            {
                RaycastHit hit;
                Vector3 direction = obj.transform.position - agent.transform.position;
                direction.Normalize();
                Vector3 right = Vector3.Cross(direction.normalized, Vector3.up);
                Vector3 left = -right;
                if (Physics.Raycast(agent.transform.position+direction, direction, out hit))
                {
                    if (hit.transform.gameObject == obj)

                    {
                        if (Physics.Raycast(agent.transform.position + direction + right *0.5f, direction, out hit))
                        {
                            if (hit.transform.gameObject == obj)
                            {
                                if (Physics.Raycast(agent.transform.position + direction + left * 0.5f, direction, out hit))
                                {
                                    if (hit.transform.gameObject == obj)
                                        return false;
                                }
                            }
                        }
                    }
                }
            }
            return true;
        }
        public override void Init()
        {
            agent = controller.GetComponent<AgentLefevre>();
            AddTransition(new LostTarget());

            agent.CancelInvoke();
        }
        public override void Init()
        {
            agent = controller.GetComponent<AgentLefevre>();
            AddTransition(new SeeTarget());

            agent.RefreshTargets();
            agent.target = agent.targets[Random.Range(0, agent.targets.Count)];
            agent.CancelInvoke();
            agent.InvokeRepeating("UpdateRoad", 0f, 0.5f);
        }