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

Requires a CharacterMovement ability. Makes the character move randomly, until it finds an obstacle in its path, in which case it'll pick a new direction at random More...

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

Public Member Functions

override void Initialization ()
 On start we grab our character movement component and pick a random direction More...
 
override void PerformAction ()
 On PerformAction we move More...
 
override void OnExitState ()
 On exit state we stop our movement More...
 
- Public Member Functions inherited from MoreMountains.Tools.AIAction
virtual void OnEnterState ()
 Describes what happens when the brain enters the state this action is in. Meant to be overridden. More...
 

Public Attributes

float MaximumDurationInADirection = 2f
 the maximum time a character can spend going in a direction without changing More...
 
LayerMask ObstacleLayerMask = LayerManager.ObstaclesLayerMask
 the layers the character will try to avoid More...
 
float ObstaclesDetectionDistance = 1f
 the minimum distance from the target this Character can reach. More...
 
float ObstaclesCheckFrequency = 0f
 the frequency (in seconds) at which to check for obstacles More...
 
Vector2 MinimumRandomDirection = new Vector2(-1f, -1f)
 the minimal random direction to randomize from More...
 
Vector2 MaximumRandomDirection = new Vector2(1f, 1f)
 the maximum random direction to randomize from 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

virtual void Move ()
 Moves the character More...
 
virtual void CheckForObstacles ()
 Checks for obstacles by casting a ray More...
 
virtual void CheckForDuration ()
 Checks whether or not we should pick a new direction at random More...
 
virtual void PickRandomDirection ()
 Picks a random direction More...
 
- Protected Member Functions inherited from MoreMountains.Tools.AIAction
virtual void Awake ()
 On Awake we grab our AIBrain More...
 

Protected Attributes

CharacterMovement _characterMovement
 
Vector2 _direction
 
Collider2D _collider
 
float _lastObstacleDetectionTimestamp = 0f
 
float _lastDirectionChangeTimestamp = 0f
 
- Protected Attributes inherited from MoreMountains.Tools.AIAction
bool _initialized
 
AIBrain _brain
 

Additional Inherited Members

- Public Types inherited from MoreMountains.Tools.AIAction
enum  InitializationModes { InitializationModes.EveryTime, InitializationModes.OnlyOnce }
 
- Properties inherited from MoreMountains.Tools.AIAction
virtual bool ActionInProgress [get, set]
 
virtual bool ShouldInitialize [get]
 

Detailed Description

Requires a CharacterMovement ability. Makes the character move randomly, until it finds an obstacle in its path, in which case it'll pick a new direction at random

Member Function Documentation

◆ CheckForDuration()

virtual void MoreMountains.TopDownEngine.AIActionMoveRandomly2D.CheckForDuration ( )
protectedvirtual

Checks whether or not we should pick a new direction at random

◆ CheckForObstacles()

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

Checks for obstacles by casting a ray

◆ Initialization()

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

On start we grab our character movement component and pick a random direction

Reimplemented from MoreMountains.Tools.AIAction.

◆ Move()

virtual void MoreMountains.TopDownEngine.AIActionMoveRandomly2D.Move ( )
protectedvirtual

Moves the character

◆ OnExitState()

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

On exit state we stop our movement

Reimplemented from MoreMountains.Tools.AIAction.

◆ PerformAction()

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

On PerformAction we move

Implements MoreMountains.Tools.AIAction.

◆ PickRandomDirection()

virtual void MoreMountains.TopDownEngine.AIActionMoveRandomly2D.PickRandomDirection ( )
protectedvirtual

Picks a random direction

Member Data Documentation

◆ _characterMovement

CharacterMovement MoreMountains.TopDownEngine.AIActionMoveRandomly2D._characterMovement
protected

◆ _collider

Collider2D MoreMountains.TopDownEngine.AIActionMoveRandomly2D._collider
protected

◆ _direction

Vector2 MoreMountains.TopDownEngine.AIActionMoveRandomly2D._direction
protected

◆ _lastDirectionChangeTimestamp

float MoreMountains.TopDownEngine.AIActionMoveRandomly2D._lastDirectionChangeTimestamp = 0f
protected

◆ _lastObstacleDetectionTimestamp

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

◆ MaximumDurationInADirection

float MoreMountains.TopDownEngine.AIActionMoveRandomly2D.MaximumDurationInADirection = 2f

the maximum time a character can spend going in a direction without changing

◆ MaximumRandomDirection

Vector2 MoreMountains.TopDownEngine.AIActionMoveRandomly2D.MaximumRandomDirection = new Vector2(1f, 1f)

the maximum random direction to randomize from

◆ MinimumRandomDirection

Vector2 MoreMountains.TopDownEngine.AIActionMoveRandomly2D.MinimumRandomDirection = new Vector2(-1f, -1f)

the minimal random direction to randomize from

◆ ObstacleLayerMask

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

the layers the character will try to avoid

◆ ObstaclesCheckFrequency

float MoreMountains.TopDownEngine.AIActionMoveRandomly2D.ObstaclesCheckFrequency = 0f

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

◆ ObstaclesDetectionDistance

float MoreMountains.TopDownEngine.AIActionMoveRandomly2D.ObstaclesDetectionDistance = 1f

the minimum distance from the target this Character can reach.


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