Beispiel #1
0
    void Awake()
    {
        // Setting up the references.
        enemySight = Nozzle.TraverseHierarchy(transform, "Head").GetComponent <EnemySight>();
        enemyGrab  = GetComponent <EnemyGrab>();
        nav        = GetComponent <NavMeshAgent>();

        if (GameObject.FindWithTag(Tags.player) != null)
        {
            player = GameObject.FindWithTag(Tags.player).transform;
        }

        //playerHealth = player.GetComponent<PlayerHealth>();
        lastPlayerSighting = GameObject.FindWithTag(Tags.gameController).GetComponent <LastPlayerSighting>();
        initialRotation    = transform.rotation;
    }
Beispiel #2
0
    private AnimatorSetup animSetup;            // An instance of the AnimatorSetup helper class.


    void Awake()
    {
        // Setting up the references.
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = Nozzle.TraverseHierarchy(transform, "Head").GetComponent <EnemySight>();       //GetComponent<EnemySight>();
        enemyGrab  = GetComponent <EnemyGrab>();
        nav        = GetComponent <NavMeshAgent>();
        anim       = GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>();
        Debug.Log(hash);

        // Making sure the rotation is controlled by Mecanim.
        nav.updateRotation = false;

        // Creating an instance of the AnimatorSetup class and calling it's constructor.
        animSetup = new AnimatorSetup(anim, hash);

        // Set the weights for the shooting and gun layers to 1.
        anim.SetLayerWeight(1, 1f);
//		anim.SetLayerWeight(2, 1f);

        // We need to convert the angle for the deadzone from degrees to radians.
        deadZone *= Mathf.Deg2Rad;
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     enemyGrab = this.GetComponent <EnemyGrab> ();
     enemy     = this.GetComponent <Enemy> ();
 }