Пример #1
0
 // Init function
 void Awake()
 {
     // Initialize shoot ray
     shootRay_ = new Ray();
     // Get player controller component
     playerController_ = transform.root.GetComponent <PlayerControllerAnimated>();
     // Get active gun component
     activeGun_ = GetComponentInChildren <SciFiRifle>();
     // Set aim spread to default value
     aimSpread_ = 1.0f;
 }
Пример #2
0
    // Init function
    void Start()
    {
        // Get player transform matrix
        player_ = GameObject.FindGameObjectWithTag("Player").transform;
        // Get navigation mesh agent component
        nav_ = GetComponent <NavMeshAgent>();
        // Get capsule component
        capsule_ = GetComponent <CapsuleCollider>();
        // Get enemy health script
        enemyHealth_ = GetComponent <EnemyHealth>();
        // Get player controller script
        playerController_ = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControllerAnimated>();

        // Get active gun component
        activeGun_ = GetComponentInChildren <SciFiRifle>();
        // Get animator component
        anim_ = GetComponent <Animator>();
        // Get walk audio component
        walkAudio_ = GetComponents <AudioSource>()[0];
        // Get speech audio component
        speechAudio_ = GetComponents <AudioSource>()[1];

        // Get environment layer mask for shooting
        environmentMask_ = LayerMask.GetMask("Environment");

        // Create shoot ray
        shootRay_ = new Ray();
        // Get minimum distance to be able to move and shoot
        minShootRange_ = activeGun_.GetRange() / 4.0f - 5.0f; // 10
        // Get maximum distance to be able to shoot
        maxShootRange_ = activeGun_.GetRange() / 4.0f + 5.0f; // 20
        // Clear distraction point
        distractionPoint_ = NO_DISTRACTION_SET;

        // Go to the next point in defined path
        GoToNextPoint();
    }
Пример #3
0
 // Init function
 void Start()
 {
     // Get player controller script component
     playerController = GetComponentInParent <PlayerControllerAnimated>();
 }