Corgi Engine v9.4
Loading...
Searching...
No Matches
MoreMountains.CorgiEngine.AIActionPatrolWithinBounds Class Reference

Inherits from AIActionPatrol but also lets you define left and right bounds that the character can't exceed. More...

Inheritance diagram for MoreMountains.CorgiEngine.AIActionPatrolWithinBounds:
MoreMountains.CorgiEngine.AIActionPatrol MoreMountains.Tools.AIAction

Public Types

enum  BoundsMethods { BasedOnOriginPosition , BasedOnStateEnterPosition }
 BoundsMethods determine whether the bounds will be defined based on the starting position of the Character, or the position it was at when entering the state. More...
Public Types inherited from MoreMountains.Tools.AIAction
enum  InitializationModes { EveryTime , OnlyOnce }

Public Member Functions

override void Initialization ()
 On init we store our initial position and define our bounds.
override void OnEnterState ()
 On Enter state we determine our bounds if required.
override void OnExitState ()
 On exit state we stop moving.
Public Member Functions inherited from MoreMountains.CorgiEngine.AIActionPatrol
override void PerformAction ()
 On PerformAction we patrol.
Public Member Functions inherited from MoreMountains.Tools.AIAction
void PerformAction ()

Public Attributes

BoundsMethods BoundsMethod = BoundsMethods.BasedOnOriginPosition
 the chosen BoundsMethod
float BoundsExtentsLeft
 the max distance the character can patrol to the left
float BoundsExtentsRight
 the max distance the character can patrol to the right
Public Attributes inherited from MoreMountains.CorgiEngine.AIActionPatrol
bool ChangeDirectionOnWall = true
 If set to true, the agent will change direction when hitting a wall.
bool AvoidFalling = false
 If set to true, the agent will try and avoid falling.
Vector3 HoleDetectionOffset = new Vector3(0, 0, 0)
 The offset the hole detection should take into account.
float HoleDetectionRaycastLength = 1f
 the length of the ray cast to detect holes
bool UseCustomLayermask = false
 Whether to use a custom layermask, or simply use the platform mask defined at the character level.
LayerMask ObstaclesLayermask = LayerManager.ObstaclesLayerMask
 if using a custom layer mask, the list of layers considered as obstacles by this AI
float ObstaclesDetectionRaycastLength = 0.5f
 the length of the horizontal raycast we should use to detect obstacles that may cause a direction change
Vector2 ObstaclesDetectionRaycastOrigin = new Vector2(0.5f, 0f)
 the origin of the raycast (if casting against the same layer this object is on, the origin should be outside its collider, typically in front of it)
bool ResetPositionOnDeath = true
 if this is true, the character will automatically return to its initial position on revive
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 Patrol ()
 When patrolling we make sure we don't exceed our bounds.
virtual void CheckForDistance ()
 Determines whether or not bounds have been exceeded and turns around if needed.
virtual void EstablishBounds ()
 Determines the position of the bounds.
virtual void OnDrawGizmosSelected ()
 Draws bounds gizmos.
Protected Member Functions inherited from MoreMountains.CorgiEngine.AIActionPatrol
virtual void CheckForWalls ()
 Checks for a wall and changes direction if it meets one.
bool DetectObstaclesRegularLayermask ()
 Returns true if an obstacle is colliding with this AI, using its controller layer masks.
bool DetectObstaclesCustomLayermask ()
 Returns true if an obstacle is in front of the character, using a custom layer mask.
virtual void CheckForHoles ()
 Checks for holes.
virtual void ChangeDirection ()
 Changes the current movement direction.
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 Member Functions inherited from MoreMountains.Tools.AIAction
virtual void Awake ()
 On Awake we grab our AIBrain.

Protected Attributes

Vector3 _initialPosition
bool _init = false
Vector3 _boundsLeft
Vector3 _boundsRight
Protected Attributes inherited from MoreMountains.CorgiEngine.AIActionPatrol
CorgiController _controller
Character _character
Health _health
CharacterHorizontalMovement _characterHorizontalMovement
Vector2 _direction
Vector2 _startPosition
Vector2 _initialDirection
Vector3 _initialScale
float _distanceToTarget
Vector2 _raycastOrigin
RaycastHit2D _raycastHit2D
Vector2 _obstacleDirection
Protected Attributes inherited from MoreMountains.Tools.AIAction
bool _initialized
AIBrain _brain

Additional Inherited Members

Properties inherited from MoreMountains.Tools.AIAction
virtual bool ActionInProgress [get, set]
virtual bool ShouldInitialize [get]

Detailed Description

Inherits from AIActionPatrol but also lets you define left and right bounds that the character can't exceed.

Member Enumeration Documentation

◆ BoundsMethods

BoundsMethods determine whether the bounds will be defined based on the starting position of the Character, or the position it was at when entering the state.

Enumerator
BasedOnOriginPosition 
BasedOnStateEnterPosition 

Member Function Documentation

◆ CheckForDistance()

virtual void MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.CheckForDistance ( )
protectedvirtual

Determines whether or not bounds have been exceeded and turns around if needed.

◆ EstablishBounds()

virtual void MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.EstablishBounds ( )
protectedvirtual

Determines the position of the bounds.

◆ Initialization()

override void MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.Initialization ( )
virtual

On init we store our initial position and define our bounds.

Reimplemented from MoreMountains.CorgiEngine.AIActionPatrol.

◆ OnDrawGizmosSelected()

virtual void MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.OnDrawGizmosSelected ( )
protectedvirtual

Draws bounds gizmos.

◆ OnEnterState()

override void MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.OnEnterState ( )
virtual

On Enter state we determine our bounds if required.

Reimplemented from MoreMountains.Tools.AIAction.

◆ OnExitState()

override void MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.OnExitState ( )
virtual

On exit state we stop moving.

Reimplemented from MoreMountains.CorgiEngine.AIActionPatrol.

◆ Patrol()

override void MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.Patrol ( )
protectedvirtual

When patrolling we make sure we don't exceed our bounds.

Reimplemented from MoreMountains.CorgiEngine.AIActionPatrol.

Member Data Documentation

◆ _boundsLeft

Vector3 MoreMountains.CorgiEngine.AIActionPatrolWithinBounds._boundsLeft
protected

◆ _boundsRight

Vector3 MoreMountains.CorgiEngine.AIActionPatrolWithinBounds._boundsRight
protected

◆ _init

bool MoreMountains.CorgiEngine.AIActionPatrolWithinBounds._init = false
protected

◆ _initialPosition

Vector3 MoreMountains.CorgiEngine.AIActionPatrolWithinBounds._initialPosition
protected

◆ BoundsExtentsLeft

float MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.BoundsExtentsLeft

the max distance the character can patrol to the left

◆ BoundsExtentsRight

float MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.BoundsExtentsRight

the max distance the character can patrol to the right

◆ BoundsMethod

BoundsMethods MoreMountains.CorgiEngine.AIActionPatrolWithinBounds.BoundsMethod = BoundsMethods.BasedOnOriginPosition

the chosen BoundsMethod


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