Exemple #1
0
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     trackingInfo = transform.Find("CyberSoldier/Armature/Hips/Spine/Chest/Neck/Head/detectionObject").gameObject.GetComponent <EnemyDetect>();
     animControl  = transform.GetChild(0).GetComponent <enemyAnimControl>();
     navAgent     = transform.GetComponent <UnityEngine.AI.NavMeshAgent>();
     if (patrolRoute != null)
     {
         GetPatrolPoints();
     }
 }
Exemple #2
0
 void Start()
 {
     player        = GameObject.FindGameObjectWithTag("playerModel").GetComponent <GinoAnimControl>();
     playerVitals  = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterControl>();
     audioSource   = transform.GetComponent <AudioSource>();
     navAgent      = transform.parent.GetComponent <UnityEngine.AI.NavMeshAgent>();
     anim          = GetComponent <Animator>();
     detectObject  = transform.Find("Armature/Hips/Spine/Chest/Neck/Head/detectionObject").gameObject;
     head          = transform.Find("Armature/Hips/Spine/Chest/Neck/Head").gameObject;
     detectScript  = detectObject.GetComponent <EnemyDetect>();
     controlScript = transform.parent.GetComponent <EnemyStatControl>();
 }
Exemple #3
0
    void Start()
    {
        rb          = GetComponent <Rigidbody>();
        collider    = GetComponent <CapsuleCollider>();
        shot        = FindObjectOfType <Shot>();
        enemyDetect = GetComponent <EnemyDetect>();

        anim = GetComponentInChildren <Animator>();

        rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;

        //  Защита от дурака
        if (GroundLayer == gameObject.layer)
        {
            Debug.LogError("Слой сортировки игроков должен отличаться от слоя сортировки Земли!");
        }
    }