TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.AIActionMoveRandomly3D 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.AIActionMoveRandomly3D:
MoreMountains.Tools.AIAction

Public Member Functions

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

Public Attributes

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

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

Protected Attributes

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

Additional Inherited Members

Public Types inherited from MoreMountains.Tools.AIAction
enum  InitializationModes { EveryTime , 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.AIActionMoveRandomly3D.CheckForDuration ( )
protectedvirtual

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

◆ CheckForObstacles()

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

Checks for obstacles by casting a ray.

◆ Initialization()

override void MoreMountains.TopDownEngine.AIActionMoveRandomly3D.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.AIActionMoveRandomly3D.Move ( )
protectedvirtual

Moves the character.

◆ OnExitState()

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

On exit state we stop our movement.

Reimplemented from MoreMountains.Tools.AIAction.

◆ PerformAction()

override void MoreMountains.TopDownEngine.AIActionMoveRandomly3D.PerformAction ( )

On PerformAction we move.

◆ PickRandomDirection()

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

Picks a random direction.

Member Data Documentation

◆ _characterMovement

CharacterMovement MoreMountains.TopDownEngine.AIActionMoveRandomly3D._characterMovement
protected

◆ _collider

Collider MoreMountains.TopDownEngine.AIActionMoveRandomly3D._collider
protected

◆ _direction

Vector2 MoreMountains.TopDownEngine.AIActionMoveRandomly3D._direction
protected

◆ _lastDirectionChangeTimestamp

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

◆ _lastObstacleDetectionTimestamp

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

◆ _rayDirection

Vector3 MoreMountains.TopDownEngine.AIActionMoveRandomly3D._rayDirection
protected

◆ MaximumDurationInADirection

float MoreMountains.TopDownEngine.AIActionMoveRandomly3D.MaximumDurationInADirection = 2f

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

◆ MaximumRandomDirection

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

the maximum random direction to randomize from

◆ MinimumRandomDirection

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

the minimal random direction to randomize from

◆ ObstacleLayerMask

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

the layers the character will try to avoid

◆ ObstaclesCheckFrequency

float MoreMountains.TopDownEngine.AIActionMoveRandomly3D.ObstaclesCheckFrequency = 1f

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

◆ ObstaclesDetectionDistance

float MoreMountains.TopDownEngine.AIActionMoveRandomly3D.ObstaclesDetectionDistance = 1f

the minimum distance from the target this Character can reach.


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