/*
     * Stop existing coroutines, detecting and moving around,
     * to activate guard's behaviour
     */
    public void StopExistingCoroutines()
    {
        _pathFinding.StopAllCoroutines();
        _patrolBehav.StopAllCoroutines();
        _playerDetector.StopAllCoroutines();

        _patrolBehav.enabled    = false;
        _playerDetector.enabled = false;
        _visionCone.enabled     = false;
    }
Esempio n. 2
0
    /*
     * Stops all behaviours and set goal for guard's search to be
     * node item is in (passed parameter)
     */
    public IEnumerator GoToItem(Node nodeItemIn)
    {
        StopAllCoroutines();
        _patrolBehav.StopAllCoroutines();
        SetGoal(nodeItemIn);
        _routeToGoal = CalculateRouteToDestination();
        SetSpeed(ChaseSpeed);

        yield return(StartCoroutine(NavigateToGoal(true)));
    }