Corgi Engine
v9.1
|
Add this component to a CorgiController2D and it will walk, turn back when it hits a wall, and try and avoid holes if you ask it to. More...
Public Types | |
enum | WalkBehaviours { WalkBehaviours.Patrol, WalkBehaviours.MoveOnSight } |
The agent's possible walk behaviours : patrol will have it walk in random directions until a wall or hole is hit, MoveOnSight will make the agent move only when "seeing" a target. More... | |
Public Attributes | |
WalkBehaviours | WalkBehaviour = WalkBehaviours.Patrol |
The agent's walk behaviour. More... | |
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... | |
float | ViewDistance = 10f |
The maximum distance at which the AI can see the target. More... | |
float | StopDistance = 1f |
the horizontal distance from its target at which the agent will stop moving. Between that distance and the walk distance, the agent will slow down progressively More... | |
Vector3 | MoveOnSightRayOffset = new Vector3(0,0,0) |
The offset to apply to the raycast origin point (by default the position of the object) More... | |
LayerMask | MoveOnSightLayer = LayerManager.PlayerLayerMask |
the layer mask to use to detect targets More... | |
LayerMask | MoveOnSightObstaclesLayer = LayerManager.ObstaclesLayerMask |
the layer mask of the sight obstacles (usually platforms) More... | |
Vector3 | ObstacleDetectionRayOffset = new Vector3(0,0,0) |
The offset to apply to the raycast origin point (by default the position of the object) More... | |
bool | ResetPositionOnDeath = true |
if this is true, the character will automatically return to its initial position on revive More... | |
Protected Member Functions | |
virtual void | Start () |
Initialization More... | |
virtual void | Initialization () |
virtual void | Update () |
Every frame, moves the agent and checks if it can shoot at the player. More... | |
virtual void | CheckForWalls () |
Checks for a wall and changes direction if it meets one More... | |
virtual void | CheckForHoles () |
Checks for holes More... | |
virtual void | CheckForTarget () |
Casts a ray (if needed) to see if a target is in sight. If yes, moves towards it. More... | |
virtual void | ChangeDirection () |
Changes the agent's direction and flips its transform More... | |
virtual void | OnRevive () |
virtual void | OnEnable () |
When the player respawns, we reinstate this agent. More... | |
virtual void | OnDisable () |
Protected Attributes | |
CorgiController | _controller |
Character | _character |
Health | _health |
CharacterHorizontalMovement | _characterHorizontalMovement |
Vector2 | _direction |
Vector2 | _startPosition |
Vector2 | _initialDirection |
Vector3 | _initialScale |
float | _distanceToTarget |
Vector2 | _raycastOrigin |
Vector2 | _offset |
Add this component to a CorgiController2D and it will walk, turn back when it hits a wall, and try and avoid holes if you ask it to.
|
strong |
|
protectedvirtual |
Changes the agent's direction and flips its transform
|
protectedvirtual |
Checks for holes
|
protectedvirtual |
Casts a ray (if needed) to see if a target is in sight. If yes, moves towards it.
|
protectedvirtual |
Checks for a wall and changes direction if it meets one
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
When the player respawns, we reinstate this agent.
checkpoint | Checkpoint. |
player | Player. |
|
protectedvirtual |
|
protectedvirtual |
Initialization
|
protectedvirtual |
Every frame, moves the agent and checks if it can shoot at the player.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool MoreMountains.CorgiEngine.AIWalk.AvoidFalling = false |
If set to true, the agent will try and avoid falling.
bool MoreMountains.CorgiEngine.AIWalk.ChangeDirectionOnWall = true |
If set to true, the agent will change direction when hitting a wall.
Vector3 MoreMountains.CorgiEngine.AIWalk.HoleDetectionOffset = new Vector3(0, 0, 0) |
The offset the hole detection should take into account.
float MoreMountains.CorgiEngine.AIWalk.HoleDetectionRaycastLength =1f |
the length of the ray cast to detect holes
LayerMask MoreMountains.CorgiEngine.AIWalk.MoveOnSightLayer = LayerManager.PlayerLayerMask |
the layer mask to use to detect targets
LayerMask MoreMountains.CorgiEngine.AIWalk.MoveOnSightObstaclesLayer = LayerManager.ObstaclesLayerMask |
the layer mask of the sight obstacles (usually platforms)
Vector3 MoreMountains.CorgiEngine.AIWalk.MoveOnSightRayOffset = new Vector3(0,0,0) |
The offset to apply to the raycast origin point (by default the position of the object)
Vector3 MoreMountains.CorgiEngine.AIWalk.ObstacleDetectionRayOffset = new Vector3(0,0,0) |
The offset to apply to the raycast origin point (by default the position of the object)
bool MoreMountains.CorgiEngine.AIWalk.ResetPositionOnDeath = true |
if this is true, the character will automatically return to its initial position on revive
float MoreMountains.CorgiEngine.AIWalk.StopDistance = 1f |
the horizontal distance from its target at which the agent will stop moving. Between that distance and the walk distance, the agent will slow down progressively
float MoreMountains.CorgiEngine.AIWalk.ViewDistance = 10f |
The maximum distance at which the AI can see the target.
WalkBehaviours MoreMountains.CorgiEngine.AIWalk.WalkBehaviour = WalkBehaviours.Patrol |
The agent's walk behaviour.