This Decision will return true if any object on its TargetLayer layermask enters its line of sight. It will also set the Brain's Target to that object. You can choose to have it in ray mode, in which case its line of sight will be an actual line (a raycast), or have it be wider (in which case it'll use a spherecast). You can also specify an offset for the ray's origin, and an obstacle layer mask that will block it.
More...
|
| override void | Initialization () |
| | On Init we grab our character.
|
| override bool | Decide () |
| | On Decide we look for a target.
|
| bool | Decide () |
| | Decide will be performed every frame while the Brain is in a state this Decision is in. Should return true or false, which will then determine the transition's outcome.
|
| virtual void | OnEnterState () |
| | Meant to be overridden, called when the Brain enters a State this Decision is in.
|
| virtual void | OnExitState () |
| | Meant to be overridden, called when the Brain exits a State this Decision is in.
|
|
| virtual bool | DetectTarget () |
| | Returns true if a target is found by the ray.
|
| virtual void | OnDrawGizmos () |
| | Draws ray gizmos.
|
| virtual void | Awake () |
| | On Awake we grab our Brain.
|
This Decision will return true if any object on its TargetLayer layermask enters its line of sight. It will also set the Brain's Target to that object. You can choose to have it in ray mode, in which case its line of sight will be an actual line (a raycast), or have it be wider (in which case it'll use a spherecast). You can also specify an offset for the ray's origin, and an obstacle layer mask that will block it.
◆ DetectionDirections
the possible detection directions
| Enumerator |
|---|
| Front | |
| Back | |
| Both | |
◆ DetectMethods
the possible detection methods
◆ Decide()
| override bool MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.Decide |
( |
| ) |
|
On Decide we look for a target.
- Returns
◆ DetectTarget()
| virtual bool MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.DetectTarget |
( |
| ) |
|
|
protectedvirtual |
Returns true if a target is found by the ray.
- Returns
◆ Initialization()
| override void MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.Initialization |
( |
| ) |
|
|
virtual |
◆ OnDrawGizmos()
| virtual void MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.OnDrawGizmos |
( |
| ) |
|
|
protectedvirtual |
◆ _boxcastSize
| Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._boxcastSize = Vector2.zero |
|
protected |
◆ _character
| Character MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._character |
|
protected |
◆ _direction
| Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._direction |
|
protected |
◆ _distanceToTarget
| float MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._distanceToTarget |
|
protected |
◆ _drawLeftGizmo
| bool MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._drawLeftGizmo = false |
|
protected |
◆ _drawRightGizmo
| bool MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._drawRightGizmo = false |
|
protected |
◆ _facingDirection
| Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._facingDirection |
|
protected |
◆ _gizmoCenter
| Vector3 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._gizmoCenter |
|
protected |
◆ _gizmosColor
| Color MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._gizmosColor = Color.yellow |
|
protected |
◆ _gizmoSize
| Vector3 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._gizmoSize |
|
protected |
◆ _init
| bool MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._init = false |
|
protected |
◆ _isFacingRight
| bool MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._isFacingRight = true |
|
protected |
◆ _orientation2D
◆ _raycastOrigin
| Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._raycastOrigin |
|
protected |
◆ DetectionDirection
◆ DetectionDistance
| float MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.DetectionDistance = 10f |
the distance up to which we'll cast our rays
◆ DetectionOriginOffset
| Vector3 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.DetectionOriginOffset = new Vector3(0,0,0) |
the offset to apply to the ray(s)
◆ DetectMethod
◆ ObstaclesLayer
| LayerMask MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.ObstaclesLayer = LayerManager.ObstaclesLayerMask |
the layer(s) on which obstacles are set. Obstacles will block the ray
◆ RayWidth
| float MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.RayWidth = 1f |
the width of the ray to cast (if we're in WideRay mode only
◆ ReferenceTransform
| Transform MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.ReferenceTransform |
a transform to use as the rotation reference for detection raycasts. If you have a rotating model for example, you'll want to set it as your reference transform here.
◆ SetTargetToNullIfNoneIsFound
| bool MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.SetTargetToNullIfNoneIsFound = true |
if this is true, this decision will set the AI Brain's Target to null if no target is found
◆ TargetLayer
| LayerMask MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D.TargetLayer |
the layer(s) on which we want to search a target on
◆ _transformDown
| virtual Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._transformDown |
|
getprotected |
◆ _transformLeft
| virtual Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._transformLeft |
|
getprotected |
◆ _transformRight
| virtual Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._transformRight |
|
getprotected |
◆ _transformUp
| virtual Vector2 MoreMountains.TopDownEngine.AIDecisionDetectTargetLine2D._transformUp |
|
getprotected |
The documentation for this class was generated from the following file: