AIController.handleLured C# (CSharp) Method

handleLured() protected method

protected handleLured ( ) : bool
return bool
	protected bool handleLured ()
	{
		if (Vector3.Distance (transform.position, nextPath.transform.position) <= 0.35) 
		{  
			// compute offset distance to avoid collisions
			if (luredTimeLeft == lureCooldownSeconds) 
			{
				//Debug.Log ("Sitting");
				setAnimatorInteger (walkingKey, (int)WalkingDirection.STILL_DOWN_LEFT);
			}

			nextPath.transform.position = transform.position; // Set the nextpath to current path to stop moving
			luredTimeLeft -= Time.deltaTime;
			if (luredTimeLeft <= 0) 
			{
				lured = false;
				MessageCenter.Instance.Broadcast(new LureReleasedMessage(null, gameObject));
				if (nextPath.tag.Equals (lureTag)) 
				{
					Destroy (nextPath);
					//Debug.Log ("Destroyed nextpath");
				} 
				else 
				{
					//Debug.Log ("Didn't destroy: " + nextPath.tag);
				}
				lureTexture.renderer.enabled = false;
				nextPath = getNextPath (); // resume normal behaviour
			}
			return true;
		}
		else
		{
			luredTimeLeft -= Time.deltaTime;
			if (luredTimeLeft <= 0)
			{
				lured = false;
				MessageCenter.Instance.Broadcast(new LureReleasedMessage(null, gameObject));
				if (nextPath.tag.Equals (lureTag)) 
				{
					Destroy (nextPath);
					//Debug.Log ("Destroyed nextpath");
				} 
				else 
				{
					//Debug.Log ("Didn't destroy: " + nextPath.tag);
				}
				lureTexture.renderer.enabled = false;
				nextPath = getNextPath (); // resume normal behaviour
			}
		}
		
		return false;
	}