Ejemplo n.º 1
0
    private void Look()
    {
        RaycastHit hit;

        if (enemy.canSeePlayer(out hit))
        {
            if (hit.distance >= enemy.toleratedSightrange)     //Wenn Spieler im Toleranzbereich erstmal stoppen und schauen
            {
                StopAndLook(hit);
            }
            else
            {
                enemy.chaseTarget = hit.transform;          //Wenn Spieler unterm Toleranzbereich ist direkt chasen
                searchTimer       = 0f;
                isLooking         = false;
                enemy.wantedLevel.RaiseWantedLevel();
                enemy.viewCone.setAlarmed(true, 1f);
                ToChaseState();
            }
        }
        else if (searchTimer >= enemy.stoppingTime && searchTimer != 0)
        {
            isLooking = false;
        }
        else if (searchTimer < enemy.stoppingTime && searchTimer > 0)
        {
            searchTimer += Time.deltaTime;
        }
    }
Ejemplo n.º 2
0
    private void Look()
    {
        RaycastHit hit;

        if (enemy.canSeePlayer(out hit))
        {
            enemy.chaseTarget = hit.transform;

            enemy.navMeshAgent.SetDestination(enemy.targetPos);
            enemy.wantedLevel.RaiseWantedLevel();
            ToChaseState();
        }
    }
Ejemplo n.º 3
0
    private void Look()
    {
        RaycastHit hit;

        //Vector3 enemyToTarget = enemy.chaseTarget.position - enemy.eyes.transform.position;
        if (enemy.canSeePlayer(out hit))
        {
            enemy.chaseTarget = hit.transform;
            enemy.wantedLevel.RaiseWantedLevel();

            Vector3 enemyToPlayer  = enemy.playerActor.transform.position - enemy.transform.position;
            float   playerDistance = enemyToPlayer.magnitude;
            //if (playerDistance <= enemy.playerIsCaughtDistance)
            //    enemy.caughtPlayer();
        }
        else
        {
            ToAlertState();
        }
    }