private void CheckScripts()
 {
     if (detectorEnemiesInAttackZone.IsEnemyDetected())
     {
         isAttacking   = true;
         countTrunings = 1;
         numOfTurning  = -1;
     }
     else if (myMovementScript.IsWalking())
     {
         isWalking     = true;
         countTrunings = 1;
         numOfTurning  = -1;
     }
     else if (myMovementScript.IsRunning())
     {
         isRunning     = true;
         countTrunings = 1;
         numOfTurning  = -1;
     }
     else if (myPatrolmanScript != null)
     {
         if (myPatrolmanScript.IsWaitingOnPoint())
         {
             if (numOfTurning == -1)
             {
                 numOfTurning = UnityEngine.Random.Range(0, maxNumOfTurnings + 1);
             }
             if (numOfTurning >= countTrunings)
             {
                 isTurningHead = true;
             }
         }
     }
 }
Exemplo n.º 2
0
    private void CheckTargetType()
    {
        if (currentTarget == null) { return; }

        if ((patrolman.ShoulIGoToPlayer() && DetectorEnemiesInAttackZone.IsEnemyDetected()) || (!patrolman.ShoulIGoToPlayer() && !patrolman.ShoulIGoToPatrolPoint()) || isTouchingInvisibleWall)
        {
            currentStateMove = StatesOfMove.Stand;
        }
        else if (patrolman.ShoulIGoToPlayer() && !DetectorEnemiesInAttackZone.IsEnemyDetected())
        {
            currentStateMove = StatesOfMove.Run;
        }
        else if (patrolman.ShoulIGoToPatrolPoint()) {
            currentStateMove = StatesOfMove.Walk;
        }
        /*else
        {
            currentState = StatesOfMove.Stand;
        }*/

    }