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

Enemy AI which runs a default movement until damage at which point it hides. Optionally if hit while hiding it can enter a charge state. More...

Inheritance diagram for PlatformerPro.EnemyAI_HideOnDamage:
PlatformerPro.EnemyAI PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

override void Init (Enemy enemy)
 Init this enemy AI. More...
 
override bool Sense ()
 The sense routine used to detect when something changes. In this case cast a ray from the transform in the facing direction to look for the player. More...
 
override EnemyState Decide ()
 Decide the next move. More...
 
override DamageInfo DoDamage (DamageInfo info)
 Used to inform the AI we were damaged so an action like HIDE may be triggered. More...
 
- Public Member Functions inherited from PlatformerPro.EnemyAI
virtual bool UpdateTimer ()
 Update the timer by frame time, we drive this externally so we can halt the mob from a single place (the Enemy script). More...
 
virtual void StateTransitioned ()
 Called to tell the AI that we were able to handle the desired state. More...
 
virtual void StateNotTransitioned ()
 Called to tell the AI that we were not able to handle the desired state. Usually due to a movement that wont release control. More...
 
virtual void Message (string message)
 Handle a message sent to the enemy. 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 hideStateTime = 5.0f
 How long after being damaged does the enemy hide for. More...
 
bool useChargeState
 If true then the enemy will go into a charge state after being hit when hiding. More...
 
- Public Attributes inherited from PlatformerPro.EnemyAI
float decisionInterval
 How long between decisions, increasing this improves performance but makes the enemy less responsive. More...
 

Protected Member Functions

virtual void EnemyDamaged (object sender, DamageInfoEventArgs args)
 When enemy is damaged keep hiding! More...
 

Protected Attributes

float hideStateTimer
 Counts down from hideStateTime when the enemy hides. More...
 
bool isCharging
 Are we currently charging? More...
 
EnemyMovement chargeMovement
 Cached reference to a charge movement which we need to be able to set the direction on. More...
 
CharacterHitBox characterHitBox
 Optional cached copy of a cahracter hurt box enabling the enemy to collect coins and cause damage to other enemies. More...
 
- Protected Attributes inherited from PlatformerPro.EnemyAI
float decisionTimer
 Timer for tracking decision interval. More...
 
Enemy enemy
 Enemy reference. More...
 

Properties

override string ExtraSaveData [get, set]
 If we are going to save the enemy, this data will be saved if save state is enabled. More...
 
- Properties inherited from PlatformerPro.EnemyAI
virtual string ExtraSaveData [get, set]
 If we are going to save the enemy, this data will be saved if save state is enabled. 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

Enemy AI which runs a default movement until damage at which point it hides. Optionally if hit while hiding it can enter a charge state.

Member Function Documentation

◆ Decide()

override EnemyState PlatformerPro.EnemyAI_HideOnDamage.Decide ( )
virtual

Decide the next move.

Reimplemented from PlatformerPro.EnemyAI.

◆ DoDamage()

override DamageInfo PlatformerPro.EnemyAI_HideOnDamage.DoDamage ( DamageInfo  info)
virtual

Used to inform the AI we were damaged so an action like HIDE may be triggered.

Reimplemented from PlatformerPro.EnemyAI.

◆ EnemyDamaged()

virtual void PlatformerPro.EnemyAI_HideOnDamage.EnemyDamaged ( object  sender,
DamageInfoEventArgs  args 
)
protectedvirtual

When enemy is damaged keep hiding!

Parameters
senderSender.
argsArguments.

◆ Init()

override void PlatformerPro.EnemyAI_HideOnDamage.Init ( Enemy  enemy)
virtual

Init this enemy AI.

Reimplemented from PlatformerPro.EnemyAI.

◆ Sense()

override bool PlatformerPro.EnemyAI_HideOnDamage.Sense ( )
virtual

The sense routine used to detect when something changes. In this case cast a ray from the transform in the facing direction to look for the player.

Reimplemented from PlatformerPro.EnemyAI.

Member Data Documentation

◆ characterHitBox

CharacterHitBox PlatformerPro.EnemyAI_HideOnDamage.characterHitBox
protected

Optional cached copy of a cahracter hurt box enabling the enemy to collect coins and cause damage to other enemies.

◆ chargeMovement

EnemyMovement PlatformerPro.EnemyAI_HideOnDamage.chargeMovement
protected

Cached reference to a charge movement which we need to be able to set the direction on.

◆ hideStateTime

float PlatformerPro.EnemyAI_HideOnDamage.hideStateTime = 5.0f

How long after being damaged does the enemy hide for.

◆ hideStateTimer

float PlatformerPro.EnemyAI_HideOnDamage.hideStateTimer
protected

Counts down from hideStateTime when the enemy hides.

◆ isCharging

bool PlatformerPro.EnemyAI_HideOnDamage.isCharging
protected

Are we currently charging?

◆ useChargeState

bool PlatformerPro.EnemyAI_HideOnDamage.useChargeState

If true then the enemy will go into a charge state after being hit when hiding.

Property Documentation

◆ ExtraSaveData

override string PlatformerPro.EnemyAI_HideOnDamage.ExtraSaveData
getset

If we are going to save the enemy, this data will be saved if save state is enabled.


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