コード例 #1
0
    /*
     * For certain conditions after finishing a pursuit performs the according action
     * If player is dead or not seen after visual search, return to patrol
     */
    private IEnumerator PostPursuit()
    {
        if (!_player.GetComponent <PlayerNPCRelation>().dead)
        {
            _detector.SeenPlayer = false;
            _postSearch.enabled  = true;
            _spriteHand.PlayAnimation("idle");
            yield return(StartCoroutine(_postSearch.VisualSearch()));
        }

        if (_postSearch.ResumePatrol)
        {
            _player.GetComponent <PlayerNPCRelation>().CanDie = false;
            _spriteHand.StopAnimation("idle");
            yield return(StartCoroutine(FinishPatrol()));

            yield return(StartCoroutine(_patrolBehav.Wait()));

            ResumePatrolStabaliser();

            _patrolBehav.enabled = true;
            StartCoroutine(_patrolBehav.Patrolling());
        }
    }