TopDown Engine v4.5
Loading...
Searching...
No Matches
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.
override void OnExitState ()
 When exiting the state we reset our movement.
virtual void ChangeDirection ()
 Changes the current movement direction.
void ResetPatrol ()
 Resets the position of the patrol agent to the start of the path, reinitializes the path.
Public Member Functions inherited from MoreMountains.Tools.AIAction
void PerformAction ()
virtual void Initialization ()
 Initializes the action. Meant to be overridden.
virtual void OnEnterState ()
 Describes what happens when the brain enters the state this action is in. Meant to be overridden.

Public Attributes

bool ChangeDirectionOnObstacle = true
 If set to true, the agent will change direction when hitting an obstacle.
LayerMask ObstaclesLayerMask = LayerManager.ObstaclesLayerMask
 the layermask to look for obstacles on
float ObstaclesDetectionRaycastLength = 1f
 the length of the raycast used to detect obstacles
float ObstaclesCheckFrequency = 1f
 the frequency (in seconds) at which to check for obstacles
Public Attributes inherited from MoreMountains.Tools.AIAction
InitializationModes InitializationMode
 whether initialization should happen only once, or every time the brain is reset
string Label
 a label you can set to organize your AI Actions, not used by anything else

Protected Member Functions

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

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
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 { EveryTime , 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 ( )

On PerformAction we patrol.

◆ ResetPatrol()

void MoreMountains.TopDownEngine.AIActionMovePatrol2D.ResetPatrol ( )

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

◆ StopMovement()

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

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

◆ ObstaclesDetectionRaycastLength

float MoreMountains.TopDownEngine.AIActionMovePatrol2D.ObstaclesDetectionRaycastLength = 1f

the length of the raycast used to detect 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:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Characters/AI/Advanced/AIActionMovePatrol2D.cs