// Returns success if an object was found otherwise failure public override TaskStatus OnUpdate() { if (usePhysics2D) { // If the target object is null then determine if there are any objects within sight based on the layer mask if (targetObject.Value == null) { returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask, targetOffset.Value, ignoreLayerMask); } else // If the target is not null then determine if that object is within sight { returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value, targetOffset.Value, ignoreLayerMask); } } else { // If the target object is null then determine if there are any objects within sight based on the layer mask if (targetObject.Value == null) { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask, targetOffset.Value, ignoreLayerMask); } else // If the target is not null then determine if that object is within sight { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value, targetOffset.Value, ignoreLayerMask); } } if (returnedObject.Value != null) { // Return success if an object was found return(TaskStatus.Success); } // An object is not within sight so return failure return(TaskStatus.Failure); }
public static GameObject WithinSight2D( Transform transform, Vector3 positionOffset, float fieldOfViewAngle, float viewDistance, LayerMask objectLayerMask, Vector3 targetOffset, float angleOffset2D, LayerMask ignoreLayerMask) { GameObject gameObject1 = (GameObject)null; Collider2D[] collider2DArray = Physics2D.OverlapCircleAll(Vector2.op_Implicit(transform.get_position()), viewDistance, LayerMask.op_Implicit(objectLayerMask)); if (collider2DArray != null) { float num = float.PositiveInfinity; for (int index = 0; index < collider2DArray.Length; ++index) { float angle; GameObject gameObject2; if (Object.op_Inequality((Object)(gameObject2 = MovementUtility.WithinSight(transform, positionOffset, fieldOfViewAngle, viewDistance, ((Component)collider2DArray[index]).get_gameObject(), targetOffset, true, angleOffset2D, out angle, LayerMask.op_Implicit(ignoreLayerMask), false, (HumanBodyBones)0)), (Object)null) && (double)angle < (double)num) { num = angle; gameObject1 = gameObject2; } } } return(gameObject1); }
// Keep searching until an object is seen or heard (if senseAudio is enabled) public override TaskStatus OnUpdate() { if (HasArrived()) { // The agent should pause at the destination only if the max pause duration is greater than 0 if (maxPauseDuration.Value > 0) { if (destinationReachTime == -1) { destinationReachTime = Time.time; pauseTime = Random.Range(minPauseDuration.Value, maxPauseDuration.Value); } if (destinationReachTime + pauseTime <= Time.time) { // Only reset the time if a destination has been set. if (TrySetTarget()) { destinationReachTime = -1; } } } else { TrySetTarget(); } } // Detect if any objects are within sight if (overlapColliders == null) { overlapColliders = new Collider[maxCollisionCount]; } returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, overlapColliders, objectLayerMask, targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); // If an object was seen then return success if (returnedObject.Value != null) { return(TaskStatus.Success); } // Detect if any object are within audio range (if enabled) if (senseAudio.Value) { returnedObject.Value = MovementUtility.WithinHearingRange(transform, offset.Value, audibilityThreshold.Value, hearingRadius.Value, overlapColliders, objectLayerMask); // If an object was heard then return success if (returnedObject.Value != null) { return(TaskStatus.Success); } } // No object has been seen or heard so keep searching return(TaskStatus.Running); }
public static GameObject WithinSight( Transform transform, Vector3 positionOffset, float fieldOfViewAngle, float viewDistance, GameObject targetObject, Vector3 targetOffset, LayerMask ignoreLayerMask, bool useTargetBone, HumanBodyBones targetBone) { return(MovementUtility.WithinSight(transform, positionOffset, fieldOfViewAngle, viewDistance, targetObject, targetOffset, false, 0.0f, out float _, LayerMask.op_Implicit(ignoreLayerMask), useTargetBone, targetBone)); }
// Returns success if an object was found otherwise failure public override TaskStatus OnUpdate() { #if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2) if (usePhysics2D) { // If the target object is null then determine if there are any objects within sight based on the layer mask if (targetObject.Value == null) { objectInSight.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask); } else // If the target is not null then determine if that object is within sight { objectInSight.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value); } } else { #endif // If the target object is null then determine if there are any objects within sight based on the layer mask if (targetObject.Value == null) { objectInSight.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask); } else // If the target is not null then determine if that object is within sight { objectInSight.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value); } #if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2) } #endif if (objectInSight.Value != null) { for (int i = 0; i < ground.Length; i++)//ÅжÏÊÇ·ñÔÚ±ßԵλÖà { if ((ground[i].transform.position - targetObject.Value.position).magnitude < 2) { return(TaskStatus.Failure); } } // Return success if an object was found return(TaskStatus.Success); } // An object is not within sight so return failure return(TaskStatus.Failure); }
// Returns success if an object was found otherwise failure public override TaskStatus OnUpdate() { #if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2) if (usePhysics2D) { // If the target object is null then determine if there are any objects within sight based on the layer mask if (targetObject.Value == null) { objectInSight.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask); } else // If the target is not null then determine if that object is within sight { objectInSight.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value); } } else { #endif // If the target object is null then determine if there are any objects within sight based on the layer mask if (targetObject.Value == null) { objectInSight.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask); } else // If the target is not null then determine if that object is within sight { objectInSight.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value); } #if !(UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2) } #endif if (objectInSight.Value != null) { gameObjectInSight.Value = objectInSight.Value.gameObject; // Return success if an object was found return(TaskStatus.Success); } // An object is not within sight so return failure return(TaskStatus.Failure); }
public override TaskStatus OnUpdate() { if (!string.IsNullOrEmpty(targetTag.Value)) { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, GameObject.FindGameObjectWithTag(targetTag.Value), targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else { base.OnUpdate(); } if (returnedObject.Value != null) { // only change output value if target has been found OutputObject.Value = returnedObject.Value; // Return success if an object was found return(TaskStatus.Success); } // An object is not within sight so return failure return(TaskStatus.Failure); }
// Keep searching until an object is seen or heard (if senseAudio is enabled) public override TaskStatus OnUpdate() { navMeshAgent.destination = Target(); // Detect if any objects are within sight objectFound.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask); // If an object was seen then return success if (objectFound.Value != null) { return(TaskStatus.Success); } // Detect if any object are within audio range (if enabled) if (senseAudio.Value) { objectFound.Value = MovementUtility.WithinHearingRange(transform, offset.Value, linearAudibilityThreshold.Value, hearingRadius.Value, objectLayerMask); // If an object was heard then return success if (objectFound.Value != null) { return(TaskStatus.Success); } } // No object has been seen or heard so keep searching return(TaskStatus.Running); }
public virtual TaskStatus OnUpdate() { if (this.HasArrived()) { if ((double)this.maxPauseDuration.get_Value() > 0.0) { if ((double)this.destinationReachTime == -1.0) { this.destinationReachTime = Time.get_time(); this.pauseTime = Random.Range(this.minPauseDuration.get_Value(), this.maxPauseDuration.get_Value()); } if ((double)this.destinationReachTime + (double)this.pauseTime <= (double)Time.get_time() && this.TrySetTarget()) { this.destinationReachTime = -1f; } } else { this.TrySetTarget(); } } this.returnedObject.set_Value(MovementUtility.WithinSight((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), this.objectLayerMask, this.targetOffset.get_Value(), this.ignoreLayerMask, this.useTargetBone.get_Value(), this.targetBone)); if (Object.op_Inequality((Object)this.returnedObject.get_Value(), (Object)null)) { return((TaskStatus)2); } if (this.senseAudio.get_Value()) { this.returnedObject.set_Value(MovementUtility.WithinHearingRange((Transform)((Task)this).transform, this.offset.get_Value(), this.audibilityThreshold.get_Value(), this.hearingRadius.get_Value(), this.objectLayerMask)); if (Object.op_Inequality((Object)this.returnedObject.get_Value(), (Object)null)) { return((TaskStatus)2); } } return((TaskStatus)3); }
/// <summary> /// 检测对应layer且对应势力的对象 /// </summary> /// <param name="transform"></param> /// <param name="positionOffset"></param> /// <param name="fieldOfViewAngle"></param> /// <param name="viewDistance"></param> /// <param name="objectLayerMask"></param> /// <param name="势力"></param> /// <returns></returns> public static Transform WithinSight(Transform transform, Vector3 positionOffset, float fieldOfViewAngle, float viewDistance, LayerMask objectLayerMask, Individual.Power power) { Transform objectFound = null; var hitColliders = Physics.OverlapSphere(transform.position, viewDistance, objectLayerMask); if (hitColliders != null) { for (int i = 0; i < hitColliders.Length; ++i) { Transform obj; //检测势力是否一致 if (hitColliders[i].gameObject.GetComponent <Individual>().power != power) { continue; } // Call the WithinSight function to determine if this specific object is within sight if ((obj = MovementUtility.WithinSight(transform, positionOffset, fieldOfViewAngle, viewDistance, hitColliders[i].transform)) != null) { objectFound = obj; } } } return(objectFound); }
public virtual TaskStatus OnUpdate() { if (this.usePhysics2D) { if (this.targetObjects.get_Value() != null && this.targetObjects.get_Value().Count > 0) { GameObject gameObject1 = (GameObject)null; float num = float.PositiveInfinity; for (int index = 0; index < this.targetObjects.get_Value().Count; ++index) { float angle; GameObject gameObject2; if (Object.op_Inequality((Object)(gameObject2 = MovementUtility.WithinSight((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), this.targetObjects.get_Value()[index], this.targetOffset.get_Value(), true, this.angleOffset2D.get_Value(), out angle, LayerMask.op_Implicit(this.ignoreLayerMask), this.useTargetBone.get_Value(), this.targetBone)), (Object)null) && (double)angle < (double)num) { num = angle; gameObject1 = gameObject2; } } this.returnedObject.set_Value(gameObject1); } else if (Object.op_Equality((Object)this.targetObject.get_Value(), (Object)null)) { this.returnedObject.set_Value(MovementUtility.WithinSight2D((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), this.objectLayerMask, this.targetOffset.get_Value(), this.angleOffset2D.get_Value(), this.ignoreLayerMask)); } else if (!string.IsNullOrEmpty(this.targetTag.get_Value())) { this.returnedObject.set_Value(MovementUtility.WithinSight2D((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), GameObject.FindGameObjectWithTag(this.targetTag.get_Value()), this.targetOffset.get_Value(), this.angleOffset2D.get_Value(), this.ignoreLayerMask, this.useTargetBone.get_Value(), this.targetBone)); } else { this.returnedObject.set_Value(MovementUtility.WithinSight2D((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), this.targetObject.get_Value(), this.targetOffset.get_Value(), this.angleOffset2D.get_Value(), this.ignoreLayerMask, this.useTargetBone.get_Value(), this.targetBone)); } } else if (this.targetObjects.get_Value() != null && this.targetObjects.get_Value().Count > 0) { GameObject gameObject1 = (GameObject)null; float num = float.PositiveInfinity; for (int index = 0; index < this.targetObjects.get_Value().Count; ++index) { float angle; GameObject gameObject2; if (Object.op_Inequality((Object)(gameObject2 = MovementUtility.WithinSight((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), this.targetObjects.get_Value()[index], this.targetOffset.get_Value(), false, this.angleOffset2D.get_Value(), out angle, LayerMask.op_Implicit(this.ignoreLayerMask), this.useTargetBone.get_Value(), this.targetBone)), (Object)null) && (double)angle < (double)num) { num = angle; gameObject1 = gameObject2; } } this.returnedObject.set_Value(gameObject1); } else if (Object.op_Equality((Object)this.targetObject.get_Value(), (Object)null)) { this.returnedObject.set_Value(MovementUtility.WithinSight((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), this.objectLayerMask, this.targetOffset.get_Value(), this.ignoreLayerMask, this.useTargetBone.get_Value(), this.targetBone)); } else if (!string.IsNullOrEmpty(this.targetTag.get_Value())) { this.returnedObject.set_Value(MovementUtility.WithinSight((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), GameObject.FindGameObjectWithTag(this.targetTag.get_Value()), this.targetOffset.get_Value(), this.ignoreLayerMask, this.useTargetBone.get_Value(), this.targetBone)); } else { this.returnedObject.set_Value(MovementUtility.WithinSight((Transform)((Task)this).transform, this.offset.get_Value(), this.fieldOfViewAngle.get_Value(), this.viewDistance.get_Value(), this.targetObject.get_Value(), this.targetOffset.get_Value(), this.ignoreLayerMask, this.useTargetBone.get_Value(), this.targetBone)); } return(Object.op_Inequality((Object)this.returnedObject.get_Value(), (Object)null) ? (TaskStatus)2 : (TaskStatus)1); }
// Returns success if an object was found otherwise failure public override TaskStatus OnUpdate() { // The collider layers on the agent can be set to ignore raycast to prevent them from interferring with the raycast checks. if (disableAgentColliderLayer.Value) { if (agentColliderGameObjects == null) { if (usePhysics2D) { var colliders = gameObject.GetComponentsInChildren <Collider2D>(); agentColliderGameObjects = new GameObject[colliders.Length]; for (int i = 0; i < agentColliderGameObjects.Length; ++i) { agentColliderGameObjects[i] = colliders[i].gameObject; } } else { var colliders = gameObject.GetComponentsInChildren <Collider>(); agentColliderGameObjects = new GameObject[colliders.Length]; for (int i = 0; i < agentColliderGameObjects.Length; ++i) { agentColliderGameObjects[i] = colliders[i].gameObject; } } originalColliderLayer = new int[agentColliderGameObjects.Length]; } // Change the layer. Remember the previous layer so it can be reset after the check has completed. for (int i = 0; i < agentColliderGameObjects.Length; ++i) { originalColliderLayer[i] = agentColliderGameObjects[i].layer; agentColliderGameObjects[i].layer = ignoreRaycastLayer; } } if (usePhysics2D) { if (targetObjects.Value != null && targetObjects.Value.Count > 0) // If there are objects in the group list then search for the object within that list { GameObject objectFound = null; float minAngle = Mathf.Infinity; for (int i = 0; i < targetObjects.Value.Count; ++i) { float angle; GameObject obj; if ((obj = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObjects.Value[i], targetOffset.Value, true, angleOffset2D.Value, out angle, ignoreLayerMask, useTargetBone.Value, targetBone)) != null) { // This object is within sight. Set it to the objectFound GameObject if the angle is less than any of the other objects if (angle < minAngle) { minAngle = angle; objectFound = obj; } } } returnedObject.Value = objectFound; } else if (targetObject.Value != null) // If the target is not null then determine if that object is within sight { returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value, targetOffset.Value, angleOffset2D.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else if (!string.IsNullOrEmpty(targetTag.Value)) // If the target tag is not null then determine if there are any objects within sight based on the tag { returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, GameObject.FindGameObjectWithTag(targetTag.Value), targetOffset.Value, angleOffset2D.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else // If the target object is null and there is no tag then determine if there are any objects within sight based on the layer mask { if (overlap2DColliders == null) { overlap2DColliders = new Collider2D[maxCollisionCount]; } returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, overlap2DColliders, objectLayerMask, targetOffset.Value, angleOffset2D.Value, ignoreLayerMask); } } else { if (targetObjects.Value != null && targetObjects.Value.Count > 0) // If there are objects in the group list then search for the object within that list { GameObject objectFound = null; float minAngle = Mathf.Infinity; for (int i = 0; i < targetObjects.Value.Count; ++i) { float angle; GameObject obj; if ((obj = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObjects.Value[i], targetOffset.Value, false, angleOffset2D.Value, out angle, ignoreLayerMask, useTargetBone.Value, targetBone)) != null) { // This object is within sight. Set it to the objectFound GameObject if the angle is less than any of the other objects if (angle < minAngle) { minAngle = angle; objectFound = obj; } } } returnedObject.Value = objectFound; } else if (targetObject.Value != null) // If the target is not null then determine if that object is within sight { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value, targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else if (!string.IsNullOrEmpty(targetTag.Value)) // If the target tag is not null then determine if there are any objects within sight based on the tag { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, GameObject.FindGameObjectWithTag(targetTag.Value), targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else // If the target object is null and there is no tag then determine if there are any objects within sight based on the layer mask { if (overlapColliders == null) { overlapColliders = new Collider[maxCollisionCount]; } returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, overlapColliders, objectLayerMask, targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } } if (disableAgentColliderLayer.Value) { for (int i = 0; i < agentColliderGameObjects.Length; ++i) { agentColliderGameObjects[i].layer = originalColliderLayer[i]; } } if (returnedObject.Value != null) { // Return success if an object was found return(TaskStatus.Success); } // An object is not within sight so return failure return(TaskStatus.Failure); }
// Returns success if an object was found otherwise failure public override TaskStatus OnUpdate() { if (usePhysics2D) { if (targetObjects.Value != null && targetObjects.Value.Count > 0) // If there are objects in the group list then search for the object within that list { GameObject objectFound = null; float minAngle = Mathf.Infinity; for (int i = 0; i < targetObjects.Value.Count; ++i) { float angle; GameObject obj; if ((obj = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObjects.Value[i], targetOffset.Value, true, angleOffset2D.Value, out angle, ignoreLayerMask, useTargetBone.Value, targetBone)) != null) { // This object is within sight. Set it to the objectFound GameObject if the angle is less than any of the other objects if (angle < minAngle) { minAngle = angle; objectFound = obj; } } } returnedObject.Value = objectFound; } else if (!string.IsNullOrEmpty(targetTag.Value)) // If the target tag is not null then determine if there are any objects within sight based on the tag { returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, possibleTarget, targetOffset.Value, angleOffset2D.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else if (targetObject.Value == null) // If the target object is null then determine if there are any objects within sight based on the layer mask { returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask, targetOffset.Value, angleOffset2D.Value, ignoreLayerMask); } else // If the target is not null then determine if that object is within sight { returnedObject.Value = MovementUtility.WithinSight2D(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value, targetOffset.Value, angleOffset2D.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } } else { if (targetObjects.Value != null && targetObjects.Value.Count > 0) // If there are objects in the group list then search for the object within that list { GameObject objectFound = null; float minAngle = Mathf.Infinity; for (int i = 0; i < targetObjects.Value.Count; ++i) { float angle; GameObject obj; if ((obj = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObjects.Value[i], targetOffset.Value, false, angleOffset2D.Value, out angle, ignoreLayerMask, useTargetBone.Value, targetBone)) != null) { // This object is within sight. Set it to the objectFound GameObject if the angle is less than any of the other objects if (angle < minAngle) { minAngle = angle; objectFound = obj; } } } returnedObject.Value = objectFound; } else if (!string.IsNullOrEmpty(targetTag.Value)) // If the target tag is not null then determine if there are any objects within sight based on the tag { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, possibleTarget, targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else if (targetObject.Value == null) // If the target object is null then determine if there are any objects within sight based on the layer mask { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, objectLayerMask, targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } else // If the target is not null then determine if that object is within sight { returnedObject.Value = MovementUtility.WithinSight(transform, offset.Value, fieldOfViewAngle.Value, viewDistance.Value, targetObject.Value, targetOffset.Value, ignoreLayerMask, useTargetBone.Value, targetBone); } } if (returnedObject.Value != null) { // Return success if an object was found return(TaskStatus.Success); } // An object is not within sight so return failure return(TaskStatus.Failure); }