Example #1
0
    private int wayPointIndex;                                  // A counter for the way point array.


    void Awake()
    {
        enemySight         = GetComponent <EnemySight2>();
        nav                = GetComponent <NavMeshAgent>();
        player             = GameObject.FindGameObjectWithTag(Tags.player).transform;
        playerHealth       = player.GetComponent <PlayerHealth2>();
        lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <LastPlayerSighting>();
    }
Example #2
0
		// Use this for initialization
		void Awake()
		{
			enemySight = GetComponent<EnemySight2>();
			nav = GetComponent<NavMeshAgent>();
			player = GameObject.FindGameObjectWithTag("Player").transform;
			audioSource = GetComponent<AudioSource>();
			globalLastPlayerSighting = GameObject.FindGameObjectWithTag("GM").GetComponent<LastPlayerSighting>();
			character = GetComponent<ThirdPersonCharacter>();
			playerScript = player.GetComponent<Player>();

			nav.updatePosition = true;
			nav.updateRotation = false;

			currentState = AI_STATE.PATROLLING;
			animator = GetComponent<Animator>();

			nextShotDelay = 0.0f;
		}
Example #3
0
    private AnimatorSetup animSetup;                    // An instance of the AnimatorSetup helper class.


    void Awake()
    {
        // Setting up the references.
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent <EnemySight2>();
        nav        = GetComponent <NavMeshAgent>();
        anim       = GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>();

        // 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;
    }