Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.EnemyMovement_FreeFollowTarget Class Reference

An enemy movement that simply runs in a given direction optionaly shotting projectiles. More...

Inheritance diagram for PlatformerPro.EnemyMovement_FreeFollowTarget:
PlatformerPro.EnemyMovement PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

override EnemyMovement Init (Enemy enemy)
 Initialise this movement and return a reference to the ready to use movement. More...
 
override bool DoMove ()
 Moves the character. More...
 
override void HitCharacter (Character character, DamageInfo info)
 Called when the enemy hits the character. More...
 
override void SwitchDirection ()
 Called by the enemy to switch (x) direction of the movement. Note that not all movements need to support this, they may do nothing. More...
 
override void SetDirection (Vector2 direction)
 Set the direction of the charge. More...
 
- Public Member Functions inherited from PlatformerPro.EnemyMovement
virtual void DoDamage (DamageInfo info)
 Do the damage movement More...
 
virtual void DoDeath (DamageInfo info)
 Do the death movement More...
 
virtual void GainingControl ()
 Called when this movement is gaining control. More...
 
virtual bool LosingControl ()
 Called when this movement is losing control. More...
 
virtual bool CheckForEdge (int movementDirection)
 Uses the Enemies feet colliders to see if there is nothing below the enemy, and if so returns true. More...
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual void Validate (PlatformerProMonoBehaviour myTarget)
 Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More...
 

Public Attributes

float chasingSpeed = 3.0f
 How fast does enemy swim/fly when chasing. More...
 
float returningSpeed = 2.0f
 How fast does enemy swim/fly when returning home. More...
 
float turnLeeway = 0.25f
 Stops the enemy spinning on the spot when really close to the player. More...
 
LayerMask detectionLayers
 Layers to check for characters. More...
 
float detectionRange = 5.0f
 Range of the proximity sense. More...
 
float travelRange = 10.0f
 How far enemy will chase player before giving up and returning home. More...
 
float returnHomeTime = 2.0f
 If we are returning home don't look for character for this long. More...
 
GameObject rotationPoint
 If non null this game object will be rotated to face the travel direction. More...
 
float rotationSpeed = 180.0f
 How fast to rotate. More...
 
Vector3 rotationOffset
 Offset from rotatino point about which we rotate. More...
 
LayerMask geometryLayers
 Layers to check for geometry. More...
 
float lookahead = 0.5f
 How far we look past characters transform when checking for geometry. More...
 

Protected Member Functions

virtual bool CheckGeometry (Vector2 dir)
 
virtual void DoRotate (Vector2 dir)
 
virtual bool DetectTarget ()
 

Protected Attributes

Vector2 initialPosition
 Home position. More...
 
Collider2D[] proximityColliders
 Used to store results of detection overlap call. More...
 
RaycastHit2D[] geometryHits
 Used to store results of geometry detection More...
 
Vector2 currentChaseDirection
 Which way are we chasing. More...
 
float returnHomeTimer
 The return home timer. More...
 
int facingDirection
 Track the facing direction. More...
 
float noMoveTime
 Tracks how long we have been blocked by geometry. More...
 
Vector2 movement = Vector2.zero
 Direction we are moving in. More...
 
- Protected Attributes inherited from PlatformerPro.EnemyMovement
Enemy enemy
 Cached reference to the character. More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
override int FacingDirection [get]
 Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. More...
 
override AnimationState AnimationState [get]
 Called by the enemy to switch (x) direction of the movement. Note that not all movements need to support this, they may do nothing. More...
 
- Properties inherited from PlatformerPro.EnemyMovement
virtual AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
virtual string OverrideState [get]
 Gets the animation override state that this movement wants to set. More...
 
virtual int FacingDirection [get]
 Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. More...
 
virtual bool ShouldSnapToGround [get]
 If we are grounded shoudl we snap to the ground. Helps us handle slopes. More...
 
static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual string Header [get]
 Gets the header string used to describe the component. More...
 
virtual string DocLink [get]
 Gets a link to documentation site. More...
 
virtual string VideoLink [get]
 Gets a link to a youtube video. More...
 
virtual string Deprecated [get]
 If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More...
 

Detailed Description

An enemy movement that simply runs in a given direction optionaly shotting projectiles.

Member Function Documentation

◆ CheckGeometry()

virtual bool PlatformerPro.EnemyMovement_FreeFollowTarget.CheckGeometry ( Vector2  dir)
protectedvirtual

◆ DetectTarget()

virtual bool PlatformerPro.EnemyMovement_FreeFollowTarget.DetectTarget ( )
protectedvirtual

◆ DoMove()

override bool PlatformerPro.EnemyMovement_FreeFollowTarget.DoMove ( )
virtual

Moves the character.

Reimplemented from PlatformerPro.EnemyMovement.

◆ DoRotate()

virtual void PlatformerPro.EnemyMovement_FreeFollowTarget.DoRotate ( Vector2  dir)
protectedvirtual

◆ HitCharacter()

override void PlatformerPro.EnemyMovement_FreeFollowTarget.HitCharacter ( Character  character,
DamageInfo  info 
)
virtual

Called when the enemy hits the character.

Parameters
characterCharacter.
infoDamage info.

Reimplemented from PlatformerPro.EnemyMovement.

◆ Init()

override EnemyMovement PlatformerPro.EnemyMovement_FreeFollowTarget.Init ( Enemy  enemy)
virtual

Initialise this movement and return a reference to the ready to use movement.

Reimplemented from PlatformerPro.EnemyMovement.

◆ SetDirection()

override void PlatformerPro.EnemyMovement_FreeFollowTarget.SetDirection ( Vector2  direction)
virtual

Set the direction of the charge.

Parameters
directionDirection.

Reimplemented from PlatformerPro.EnemyMovement.

◆ SwitchDirection()

override void PlatformerPro.EnemyMovement_FreeFollowTarget.SwitchDirection ( )
virtual

Called by the enemy to switch (x) direction of the movement. Note that not all movements need to support this, they may do nothing.

Reimplemented from PlatformerPro.EnemyMovement.

Member Data Documentation

◆ chasingSpeed

float PlatformerPro.EnemyMovement_FreeFollowTarget.chasingSpeed = 3.0f

How fast does enemy swim/fly when chasing.

◆ currentChaseDirection

Vector2 PlatformerPro.EnemyMovement_FreeFollowTarget.currentChaseDirection
protected

Which way are we chasing.

◆ detectionLayers

LayerMask PlatformerPro.EnemyMovement_FreeFollowTarget.detectionLayers

Layers to check for characters.

◆ detectionRange

float PlatformerPro.EnemyMovement_FreeFollowTarget.detectionRange = 5.0f

Range of the proximity sense.

◆ facingDirection

int PlatformerPro.EnemyMovement_FreeFollowTarget.facingDirection
protected

Track the facing direction.

◆ geometryHits

RaycastHit2D [] PlatformerPro.EnemyMovement_FreeFollowTarget.geometryHits
protected

Used to store results of geometry detection

◆ geometryLayers

LayerMask PlatformerPro.EnemyMovement_FreeFollowTarget.geometryLayers

Layers to check for geometry.

◆ initialPosition

Vector2 PlatformerPro.EnemyMovement_FreeFollowTarget.initialPosition
protected

Home position.

◆ lookahead

float PlatformerPro.EnemyMovement_FreeFollowTarget.lookahead = 0.5f

How far we look past characters transform when checking for geometry.

◆ movement

Vector2 PlatformerPro.EnemyMovement_FreeFollowTarget.movement = Vector2.zero
protected

Direction we are moving in.

◆ noMoveTime

float PlatformerPro.EnemyMovement_FreeFollowTarget.noMoveTime
protected

Tracks how long we have been blocked by geometry.

◆ proximityColliders

Collider2D [] PlatformerPro.EnemyMovement_FreeFollowTarget.proximityColliders
protected

Used to store results of detection overlap call.

◆ returnHomeTime

float PlatformerPro.EnemyMovement_FreeFollowTarget.returnHomeTime = 2.0f

If we are returning home don't look for character for this long.

◆ returnHomeTimer

float PlatformerPro.EnemyMovement_FreeFollowTarget.returnHomeTimer
protected

The return home timer.

◆ returningSpeed

float PlatformerPro.EnemyMovement_FreeFollowTarget.returningSpeed = 2.0f

How fast does enemy swim/fly when returning home.

◆ rotationOffset

Vector3 PlatformerPro.EnemyMovement_FreeFollowTarget.rotationOffset

Offset from rotatino point about which we rotate.

◆ rotationPoint

GameObject PlatformerPro.EnemyMovement_FreeFollowTarget.rotationPoint

If non null this game object will be rotated to face the travel direction.

◆ rotationSpeed

float PlatformerPro.EnemyMovement_FreeFollowTarget.rotationSpeed = 180.0f

How fast to rotate.

◆ travelRange

float PlatformerPro.EnemyMovement_FreeFollowTarget.travelRange = 10.0f

How far enemy will chase player before giving up and returning home.

◆ turnLeeway

float PlatformerPro.EnemyMovement_FreeFollowTarget.turnLeeway = 0.25f

Stops the enemy spinning on the spot when really close to the player.

Property Documentation

◆ AnimationState

override AnimationState PlatformerPro.EnemyMovement_FreeFollowTarget.AnimationState
get

Called by the enemy to switch (x) direction of the movement. Note that not all movements need to support this, they may do nothing.

◆ FacingDirection

override int PlatformerPro.EnemyMovement_FreeFollowTarget.FacingDirection
get

Returns the direction the character is facing. 0 for none, 1 for right, -1 for left.

◆ Info

new static MovementInfo PlatformerPro.EnemyMovement_FreeFollowTarget.Info
staticget

Static movement info used by the editor.


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