示例#1
0
    public void Update()
    {
        //If the player is in view then switch to combat
        if (_fov.IsEnemyInFOV)
        {
            _agent.Aggrevate();
        }


        if (_navAgent.remainingDistance <= 1.5f)
        {
            _timer += Time.deltaTime;

            //If the AI have stood still for enough time
            if (_timer > _timeAtEachSearchPoint)
            {
                //Go to next point
                _timer = 0.0f;
                _index++;

                //Sets the next position to go to
                if (_index < _searchLocations.Length)
                {
                    _navAgent.SetDestination(_searchLocations[_index]);
                }
                //Return to their default state
                else
                {
                    GameObject.FindObjectOfType <PlayerController>().IsDetected = false;
                    _agent.ReturnToDefaultState();
                }
            }
        }
    }
 protected override void OnDamage()
 {
     //Aggrevate Enemies on hit.
     _aiAgent.Aggrevate();
 }