TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D Class Reference

This decision returns true if there's no obstacle in a straight line between the agent and the brain's target, in 2D. More...

Inheritance diagram for MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D:
MoreMountains.Tools.AIDecision

Public Member Functions

override void Initialization ()
 On init we grab our collider.
override bool Decide ()
 On Decide we check whether we have a line of sight.
Public Member Functions inherited from MoreMountains.Tools.AIDecision
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.

Public Attributes

LayerMask ObstacleLayerMask = LayerManager.ObstaclesLayerMask
 the layermask to consider as obstacles when trying to determine whether a line of sight is present
Vector3 LineOfSightOffset = new Vector3(0, 0, 0)
 the offset to apply (from the collider's center) when casting a ray from the agent to its target
Public Attributes inherited from MoreMountains.Tools.AIDecision
string Label
 a label you can set to organize your AI Decisions, not used by anything else

Protected Member Functions

virtual bool CheckLineOfSight ()
 Checks whether there are obstacles between the agent and the target.
Protected Member Functions inherited from MoreMountains.Tools.AIDecision
virtual void Awake ()
 On Awake we grab our Brain.

Protected Attributes

Vector2 _directionToTarget
Collider2D _collider
Vector2 _raycastOrigin
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 returns true if there's no obstacle in a straight line between the agent and the brain's target, in 2D.

Member Function Documentation

◆ CheckLineOfSight()

virtual bool MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D.CheckLineOfSight ( )
protectedvirtual

Checks whether there are obstacles between the agent and the target.

Returns

◆ Decide()

override bool MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D.Decide ( )

On Decide we check whether we have a line of sight.

Returns

◆ Initialization()

override void MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D.Initialization ( )
virtual

On init we grab our collider.

Reimplemented from MoreMountains.Tools.AIDecision.

Member Data Documentation

◆ _collider

Collider2D MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D._collider
protected

◆ _directionToTarget

Vector2 MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D._directionToTarget
protected

◆ _raycastOrigin

Vector2 MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D._raycastOrigin
protected

◆ LineOfSightOffset

Vector3 MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D.LineOfSightOffset = new Vector3(0, 0, 0)

the offset to apply (from the collider's center) when casting a ray from the agent to its target

◆ ObstacleLayerMask

LayerMask MoreMountains.TopDownEngine.AIDecisionLineOfSightToTarget2D.ObstacleLayerMask = LayerManager.ObstaclesLayerMask

the layermask to consider as obstacles when trying to determine whether a line of sight is present


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