Exemple #1
0
    }                                                   // Is the agent alive or not?

    #endregion

    #region Methods

    // Use this for initialization
    protected virtual void Start()
    {
        //Debug.Log("Called");
        Alive = true;

        // Initialize events
        mouseOverEvent   = new EnemyMouseOverEvent();
        enemyDeathEvent  = new EnemyDeathEvent();
        enemyPursueEvent = new EnemyFoundEvent();

        // Add this script to the list of invokers for the EnemyMouseOverEvent
        EventManager.AddEnemyMouseOverInvoker(this);
        EventManager.AddEnemyDeathInvoker(this);
        GetComponentInChildren <FOVScript>().AddEnemyFoundEventListener(OnEnemyAttackEvent);

        // Initialize object variables
        speed           = MAX_SPEED;
        nextSpot        = 0;
        patrolDirection = PatrolDirection.FORWARD;
        path            = new List <Vector3>();
        animator        = GetComponent <Animator>();

        // Start in the wait state
        TransitionToWaitState();
    }
 /// <summary>
 /// Get the mesh in the parent.
 /// </summary>
 void Awake()
 {
     mesh            = GetComponentInParent <FOVMesh>();
     enemyFoundEvent = new EnemyFoundEvent();
 }