protected override void Init(AIBehaviors fsm)
    {
        if (navMeshAgent == null)
        {
            navMeshAgent = fsm.GetComponent <NavMeshAgent>();
        }

        path = null;

        previousDestination = Vector3.one * Mathf.Infinity;
    }
    // Implement your own custom GUI here if you want to
    public override void DrawInspectorProperties(AIBehaviors fsm, SerializedObject sObject)
    {
        if (fsm.GetComponent <NavMeshAgent>() == null)
        {
            Color oldColor = GUI.contentColor;
            GUI.contentColor = Color.yellow;
            EditorGUILayout.HelpBox("This trigger only works with an AI that uses a NavMeshAgent", MessageType.Warning);
            GUI.contentColor = oldColor;
        }

        InspectorHelper.DrawInspector(sObject);
    }
        void InitNewStates()
        {
            Dictionary <string, Type> statesDictionary = new Dictionary <string, Type>();
            List <BaseState>          statesList       = new List <BaseState>();
            bool isMecanim = fsm.GetComponent <Animator>() != null;

            // Setup a dictionary of the default states
            statesDictionary["Idle"]   = typeof(IdleState);
            statesDictionary["Patrol"] = typeof(PatrolState);
            statesDictionary["Seek"]   = typeof(SeekState);
            statesDictionary["Flee"]   = typeof(FleeState);

            if (isMecanim)
            {
                statesDictionary["Attack"] = typeof(MecanimAttackState);
            }
            else
            {
                statesDictionary["Attack"] = typeof(AttackState);
            }

            statesDictionary["Defend"]   = typeof(DefendState);
            statesDictionary["Got Hit"]  = typeof(GotHitState);
            statesDictionary["Change"]   = typeof(ChangeState);
            statesDictionary["Help"]     = typeof(HelpState);
            statesDictionary["Get Help"] = typeof(GetHelpState);
            statesDictionary["Dead"]     = typeof(DeadState);

            foreach (string stateName in statesDictionary.Keys)
            {
                string stateClassName = statesDictionary[stateName].Name;

                try
                {
                    BaseState baseState = ComponentHelper.AddComponentByName(statesGameObject, stateClassName) as BaseState;
                    baseState.name = stateName;

                    statesList.Add(baseState);
                }
                catch
                {
                    Debug.LogError("Type \"" + stateClassName + "\" does not exist.  You must have a class named \"" + stateClassName + "\" that derives from \"StateBase\".");
                    inittedSuccessfully = false;
                }
            }

            fsm.ReplaceAllStates(statesList.ToArray());
        }