TopDown Engine  v3.6
MoreMountains.TopDownEngine.AIActionMovePatrol2D Class Reference

This Action will make the Character patrol along the defined path (see the MMPath inspector for that) until it hits a wall or a hole while following a path. More...

Inheritance diagram for MoreMountains.TopDownEngine.AIActionMovePatrol2D:
MoreMountains.Tools.AIAction

Public Member Functions

override void PerformAction ()
 On PerformAction we patrol More...
 
override void OnExitState ()
 When exiting the state we reset our movement More...
 
virtual void ChangeDirection ()
 Changes the current movement direction More...
 
void ResetPatrol ()
 Resets the position of the patrol agent to the start of the path, reinitializes the path More...
 
- Public Member Functions inherited from MoreMountains.Tools.AIAction
virtual void Initialization ()
 Initializes the action. Meant to be overridden More...
 
virtual void OnEnterState ()
 Describes what happens when the brain enters the state this action is in. Meant to be overridden. More...
 

Public Attributes

bool ChangeDirectionOnObstacle = true
 If set to true, the agent will change direction when hitting an obstacle. More...
 
LayerMask ObstaclesLayerMask = LayerManager.ObstaclesLayerMask
 the layermask to look for obstacles on More...
 
float ObstaclesCheckFrequency = 1f
 the frequency (in seconds) at which to check for obstacles More...
 
- Public Attributes inherited from MoreMountains.Tools.AIAction
InitializationModes InitializationMode
 
string Label
 a label you can set to organize your AI Actions, not used by anything else More...
 

Protected Member Functions

override void Awake ()
 On init we grab all the components we'll need More...
 
virtual void InitializePatrol ()
 On init we grab all the components we'll need More...
 
virtual void Patrol ()
 This method initiates all the required checks and moves the character More...
 
virtual void DetermineDelay ()
 
virtual void OnDrawGizmosSelected ()
 Draws bounds gizmos More...
 
virtual void CheckForObstacles ()
 Checks for a wall and changes direction if it meets one More...
 
virtual void OnRevive ()
 When reviving we make sure our directions are properly setup More...
 
virtual void OnEnable ()
 On enable we start listening for OnRevive events More...
 
virtual void OnDisable ()
 On disable we stop listening for OnRevive events More...
 

Protected Attributes

TopDownController _controller
 
Character _character
 
CharacterOrientation2D _orientation2D
 
CharacterMovement _characterMovement
 
Health _health
 
Vector2 _direction
 
Vector2 _startPosition
 
Vector3 _initialScale
 
MMPath _mmPath
 
float _lastObstacleDetectionTimestamp = 0f
 
float _lastPatrolPointReachedAt = 0f
 
int _currentIndex = 0
 
int _indexLastFrame = -1
 
float _waitingDelay = 0f
 
- Protected Attributes inherited from MoreMountains.Tools.AIAction
bool _initialized
 
AIBrain _brain
 

Properties

virtual Vector3 LastReachedPatrolPoint [get, set]
 the coordinates of the last patrol point More...
 
- Properties inherited from MoreMountains.Tools.AIAction
virtual bool ActionInProgress [get, set]
 
virtual bool ShouldInitialize [get]
 

Additional Inherited Members

- Public Types inherited from MoreMountains.Tools.AIAction
enum  InitializationModes { InitializationModes.EveryTime, InitializationModes.OnlyOnce }
 

Detailed Description

This Action will make the Character patrol along the defined path (see the MMPath inspector for that) until it hits a wall or a hole while following a path.

Member Function Documentation

◆ Awake()

override void MoreMountains.TopDownEngine.AIActionMovePatrol2D.Awake ( )
protectedvirtual

On init we grab all the components we'll need

Reimplemented from MoreMountains.Tools.AIAction.

◆ ChangeDirection()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.ChangeDirection ( )
virtual

Changes the current movement direction

◆ CheckForObstacles()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.CheckForObstacles ( )
protectedvirtual

Checks for a wall and changes direction if it meets one

◆ DetermineDelay()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.DetermineDelay ( )
protectedvirtual

◆ InitializePatrol()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.InitializePatrol ( )
protectedvirtual

On init we grab all the components we'll need

◆ OnDisable()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.OnDisable ( )
protectedvirtual

On disable we stop listening for OnRevive events

◆ OnDrawGizmosSelected()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.OnDrawGizmosSelected ( )
protectedvirtual

Draws bounds gizmos

◆ OnEnable()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.OnEnable ( )
protectedvirtual

On enable we start listening for OnRevive events

◆ OnExitState()

override void MoreMountains.TopDownEngine.AIActionMovePatrol2D.OnExitState ( )
virtual

When exiting the state we reset our movement

Reimplemented from MoreMountains.Tools.AIAction.

◆ OnRevive()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.OnRevive ( )
protectedvirtual

When reviving we make sure our directions are properly setup

◆ Patrol()

virtual void MoreMountains.TopDownEngine.AIActionMovePatrol2D.Patrol ( )
protectedvirtual

This method initiates all the required checks and moves the character

◆ PerformAction()

override void MoreMountains.TopDownEngine.AIActionMovePatrol2D.PerformAction ( )
virtual

On PerformAction we patrol

Implements MoreMountains.Tools.AIAction.

◆ ResetPatrol()

void MoreMountains.TopDownEngine.AIActionMovePatrol2D.ResetPatrol ( )

Resets the position of the patrol agent to the start of the path, reinitializes the path

Member Data Documentation

◆ _character

Character MoreMountains.TopDownEngine.AIActionMovePatrol2D._character
protected

◆ _characterMovement

CharacterMovement MoreMountains.TopDownEngine.AIActionMovePatrol2D._characterMovement
protected

◆ _controller

TopDownController MoreMountains.TopDownEngine.AIActionMovePatrol2D._controller
protected

◆ _currentIndex

int MoreMountains.TopDownEngine.AIActionMovePatrol2D._currentIndex = 0
protected

◆ _direction

Vector2 MoreMountains.TopDownEngine.AIActionMovePatrol2D._direction
protected

◆ _health

Health MoreMountains.TopDownEngine.AIActionMovePatrol2D._health
protected

◆ _indexLastFrame

int MoreMountains.TopDownEngine.AIActionMovePatrol2D._indexLastFrame = -1
protected

◆ _initialScale

Vector3 MoreMountains.TopDownEngine.AIActionMovePatrol2D._initialScale
protected

◆ _lastObstacleDetectionTimestamp

float MoreMountains.TopDownEngine.AIActionMovePatrol2D._lastObstacleDetectionTimestamp = 0f
protected

◆ _lastPatrolPointReachedAt

float MoreMountains.TopDownEngine.AIActionMovePatrol2D._lastPatrolPointReachedAt = 0f
protected

◆ _mmPath

MMPath MoreMountains.TopDownEngine.AIActionMovePatrol2D._mmPath
protected

◆ _orientation2D

CharacterOrientation2D MoreMountains.TopDownEngine.AIActionMovePatrol2D._orientation2D
protected

◆ _startPosition

Vector2 MoreMountains.TopDownEngine.AIActionMovePatrol2D._startPosition
protected

◆ _waitingDelay

float MoreMountains.TopDownEngine.AIActionMovePatrol2D._waitingDelay = 0f
protected

◆ ChangeDirectionOnObstacle

bool MoreMountains.TopDownEngine.AIActionMovePatrol2D.ChangeDirectionOnObstacle = true

If set to true, the agent will change direction when hitting an obstacle.

◆ ObstaclesCheckFrequency

float MoreMountains.TopDownEngine.AIActionMovePatrol2D.ObstaclesCheckFrequency = 1f

the frequency (in seconds) at which to check for obstacles

◆ ObstaclesLayerMask

LayerMask MoreMountains.TopDownEngine.AIActionMovePatrol2D.ObstaclesLayerMask = LayerManager.ObstaclesLayerMask

the layermask to look for obstacles on

Property Documentation

◆ LastReachedPatrolPoint

virtual Vector3 MoreMountains.TopDownEngine.AIActionMovePatrol2D.LastReachedPatrolPoint
getset

the coordinates of the last patrol point


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