Ejemplo n.º 1
0
    private void findTargetLocationToFire()
    {
        MovingAgent humanoidOpponent = opponent as MovingAgent;

        if (humanoidOpponent != null && humanoidOpponent.isCrouched() && humanoidOpponent.isAimed())
        {
            targetLocation = humanoidOpponent.getHeadTransfrom();
        }
        else
        {
            int randomIndex = Random.Range(0, targetLocations.Length - 1);
            targetLocation = targetLocations[randomIndex].transform;
        }



        if (Random.value > m_selfAgent.getSkill())
        {
            randomOffset = Random.insideUnitSphere * 2;
        }
        else if (m_navMeshAgent.remainingDistance > 9)
        {
            randomOffset = Random.insideUnitSphere * 0.7f;
        }
        else
        {
            randomOffset = Vector3.zero;
        }
    }