Corgi Engine  v8.8
MoreMountains.CorgiEngine.AIDecisionDetectTargetLine Class Reference

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...

Inheritance diagram for MoreMountains.CorgiEngine.AIDecisionDetectTargetLine:
MoreMountains.Tools.AIDecision

Public Types

enum  DetectMethods { DetectMethods.Ray, DetectMethods.WideRay }
 the possible detection methods More...
 
enum  DetectionDirections { DetectionDirections.Front, DetectionDirections.Back, DetectionDirections.Both }
 the possible detection directions More...
 

Public Member Functions

override void Initialization ()
 On Init we grab our character More...
 
override bool Decide ()
 On Decide we look for a target More...
 
- Public Member Functions inherited from MoreMountains.Tools.AIDecision
virtual void OnEnterState ()
 Meant to be overridden, called when the Brain enters a State this Decision is in More...
 
virtual void OnExitState ()
 Meant to be overridden, called when the Brain exits a State this Decision is in More...
 

Public Attributes

DetectMethods DetectMethod = DetectMethods.Ray
 the detection method More...
 
DetectionDirections DetectionDirection = DetectionDirections.Front
 the detection direction More...
 
float RayWidth = 1f
 the width of the ray to cast (if we're in WideRay mode only More...
 
float DetectionDistance = 10f
 the distance up to which we'll cast our rays More...
 
Vector3 DetectionOriginOffset = new Vector3(0,0,0)
 the offset to apply to the ray(s) More...
 
LayerMask TargetLayer = LayerManager.PlayerLayerMask
 the layer(s) on which we want to search a target on More...
 
LayerMask ObstaclesLayer = LayerManager.ObstaclesLayerMask
 the layer(s) on which obstacles are set. Obstacles will block the ray More...
 
- Public Attributes inherited from MoreMountains.Tools.AIDecision
string Label
 a label you can set to organize your AI Decisions, not used by anything else More...
 

Protected Member Functions

virtual bool DetectTarget ()
 Returns true if a target is found by the ray More...
 
virtual void OnDrawGizmos ()
 Draws ray gizmos More...
 
- Protected Member Functions inherited from MoreMountains.Tools.AIDecision
virtual void Awake ()
 On Awake we grab our Brain More...
 

Protected Attributes

Vector2 _direction
 
Vector2 _facingDirection
 
float _distanceToTarget
 
Vector2 _raycastOrigin
 
Character _character
 
bool _drawLeftGizmo = false
 
bool _drawRightGizmo = false
 
Color _gizmosColor = Color.yellow
 
Vector3 _gizmoCenter
 
Vector3 _gizmoSize
 
bool _init = false
 
Vector2 _boxcastSize = Vector2.zero
 
- Protected Attributes inherited from MoreMountains.Tools.AIDecision
AIBrain _brain
 

Additional Inherited Members

- Properties inherited from MoreMountains.Tools.AIDecision
virtual bool DecisionInProgress [get, set]
 

Detailed Description

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.

Member Enumeration Documentation

◆ DetectionDirections

the possible detection directions

Enumerator
Front 
Back 
Both 

◆ DetectMethods

the possible detection methods

Enumerator
Ray 
WideRay 

Member Function Documentation

◆ Decide()

override bool MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.Decide ( )
virtual

On Decide we look for a target

Returns

Implements MoreMountains.Tools.AIDecision.

◆ DetectTarget()

virtual bool MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.DetectTarget ( )
protectedvirtual

Returns true if a target is found by the ray

Returns

◆ Initialization()

override void MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.Initialization ( )
virtual

On Init we grab our character

Reimplemented from MoreMountains.Tools.AIDecision.

◆ OnDrawGizmos()

virtual void MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.OnDrawGizmos ( )
protectedvirtual

Draws ray gizmos

Member Data Documentation

◆ _boxcastSize

Vector2 MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._boxcastSize = Vector2.zero
protected

◆ _character

Character MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._character
protected

◆ _direction

Vector2 MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._direction
protected

◆ _distanceToTarget

float MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._distanceToTarget
protected

◆ _drawLeftGizmo

bool MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._drawLeftGizmo = false
protected

◆ _drawRightGizmo

bool MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._drawRightGizmo = false
protected

◆ _facingDirection

Vector2 MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._facingDirection
protected

◆ _gizmoCenter

Vector3 MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._gizmoCenter
protected

◆ _gizmosColor

Color MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._gizmosColor = Color.yellow
protected

◆ _gizmoSize

Vector3 MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._gizmoSize
protected

◆ _init

bool MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._init = false
protected

◆ _raycastOrigin

Vector2 MoreMountains.CorgiEngine.AIDecisionDetectTargetLine._raycastOrigin
protected

◆ DetectionDirection

DetectionDirections MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.DetectionDirection = DetectionDirections.Front

the detection direction

◆ DetectionDistance

float MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.DetectionDistance = 10f

the distance up to which we'll cast our rays

◆ DetectionOriginOffset

Vector3 MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.DetectionOriginOffset = new Vector3(0,0,0)

the offset to apply to the ray(s)

◆ DetectMethod

DetectMethods MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.DetectMethod = DetectMethods.Ray

the detection method

◆ ObstaclesLayer

LayerMask MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.ObstaclesLayer = LayerManager.ObstaclesLayerMask

the layer(s) on which obstacles are set. Obstacles will block the ray

◆ RayWidth

float MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.RayWidth = 1f

the width of the ray to cast (if we're in WideRay mode only

◆ TargetLayer

LayerMask MoreMountains.CorgiEngine.AIDecisionDetectTargetLine.TargetLayer = LayerManager.PlayerLayerMask

the layer(s) on which we want to search a target on


The documentation for this class was generated from the following file: