Corgi Engine  v8.8
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 { BoundsMethods.BasedOnOriginPosition, BoundsMethods.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 { InitializationModes.EveryTime, InitializationModes.OnlyOnce }
 

Public Member Functions

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

Public Attributes

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

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: