AIController.lure C# (CSharp) Method

lure() protected method

protected lure ( Vector3 lurePosition ) : void
lurePosition Vector3
return void
	protected virtual void lure (Vector3 lurePosition)
	{
		if (panicked || alerted)
			return;

		//Debug.Log ("Becoming Lured: " + lurePosition);
		// Play only if not lured so that sounds only plays once for a lure, and then can be played again when lure cooldown is up
		if (!lured)
		{
			// Play curious sound for being lured
			AudioClip curious = null;
			// Get skin type to know which NPC sounds to play
			if (this.SkinType.Equals (NPCSkinType.Bopper))
			{
				curious = (AudioClip)bopperCuriousSounds[Random.Range (0, bopperCuriousSounds.Length)];
			}
			else if (this.SkinType.Equals (NPCSkinType.Hippie))
			{
				curious = (AudioClip)hippieCuriousSounds[Random.Range (0, hippieCuriousSounds.Length)];
			}
			else if (this.SkinType.Equals (NPCSkinType.Hottie))
			{
				curious = (AudioClip)hottieCuriousSounds[Random.Range (0, hottieCuriousSounds.Length)];
			}
			else if (this.SkinType.Equals (NPCSkinType.MowerMan))
			{
				curious = (AudioClip)mowerCuriousSounds[Random.Range (0, mowerCuriousSounds.Length)];
			}
			else if (this.SkinType.Equals (NPCSkinType.OldMan))
			{
				curious = (AudioClip)oldmanCuriousSounds[Random.Range (0, oldmanCuriousSounds.Length)];
			}
			
			audio.PlayOneShot (curious, 1.0f);
		}

		lureTexture.renderer.enabled = true;

		lured = true;
		nextPath = new GameObject ();
		nextPath.transform.position = lurePosition;
		nextPath.tag = lureTag;

		luredTimeLeft = lureCooldownSeconds;
	}