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

An enemy AI is typically extended for SIMPLE enemy AI controllers and is used to move control between basic enemy movements. For COMPLEX AI you will most likely implement your enemy as a character and your enemy AI as an Input to that character. More...

Inheritance diagram for PlatformerPro.EnemyAI:
PlatformerPro.PlatformerProMonoBehaviour PlatformerPro.EnemyAI_AIGraph PlatformerPro.EnemyAI_HideOnDamage PlatformerPro.EnemyAI_PatrolToAttack PlatformerPro.EnemyAI_PatrolToChargeToAttack PlatformerPro.EnemyAI_SeeAndCharge PlatformerPro.EnemyAI_SeeAndShoot PlatformerPro.EnemyAI_SeeAndShootWithHide PlatformerPro.EnemyAI_SenseAndShoot

Public Member Functions

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 EnemyState Decide ()
 Decide the next move. More...
 
virtual DamageInfo DoDamage (DamageInfo info)
 Handle damage. More...
 
virtual bool Sense ()
 The sense routine used to detect when something changes. Sense is called every frame and should be kept as simple as possible. Use Decide() for more complex logic. More...
 
virtual void Init (Enemy enemy)
 Init this enemy AI. 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 decisionInterval
 How long between decisions, increasing this improves performance but makes the enemy less responsive. More...
 

Protected Attributes

float decisionTimer
 Timer for tracking decision interval. More...
 
Enemy enemy
 Enemy reference. More...
 

Properties

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

An enemy AI is typically extended for SIMPLE enemy AI controllers and is used to move control between basic enemy movements. For COMPLEX AI you will most likely implement your enemy as a character and your enemy AI as an Input to that character.

Member Function Documentation

◆ Decide()

◆ DoDamage()

virtual DamageInfo PlatformerPro.EnemyAI.DoDamage ( DamageInfo  info)
virtual

Handle damage.

Parameters
infoDamage details
Returns
The updated damage info.

Reimplemented in PlatformerPro.EnemyAI_SeeAndShootWithHide, PlatformerPro.EnemyAI_HideOnDamage, and PlatformerPro.EnemyAI_AIGraph.

◆ Init()

◆ Message()

virtual void PlatformerPro.EnemyAI.Message ( string  message)
virtual

Handle a message sent to the enemy.

Parameters
message

Reimplemented in PlatformerPro.EnemyAI_AIGraph.

◆ Sense()

virtual bool PlatformerPro.EnemyAI.Sense ( )
virtual

The sense routine used to detect when something changes. Sense is called every frame and should be kept as simple as possible. Use Decide() for more complex logic.

Reimplemented in PlatformerPro.EnemyAI_SenseAndShoot, PlatformerPro.EnemyAI_SeeAndShootWithHide, PlatformerPro.EnemyAI_SeeAndShoot, PlatformerPro.EnemyAI_SeeAndCharge, PlatformerPro.EnemyAI_HideOnDamage, and PlatformerPro.EnemyAI_AIGraph.

◆ StateNotTransitioned()

virtual void PlatformerPro.EnemyAI.StateNotTransitioned ( )
virtual

Called to tell the AI that we were not able to handle the desired state. Usually due to a movement that wont release control.

Reimplemented in PlatformerPro.EnemyAI_AIGraph.

◆ StateTransitioned()

virtual void PlatformerPro.EnemyAI.StateTransitioned ( )
virtual

Called to tell the AI that we were able to handle the desired state.

Reimplemented in PlatformerPro.EnemyAI_AIGraph.

◆ UpdateTimer()

virtual bool PlatformerPro.EnemyAI.UpdateTimer ( )
virtual

Update the timer by frame time, we drive this externally so we can halt the mob from a single place (the Enemy script).

Member Data Documentation

◆ decisionInterval

float PlatformerPro.EnemyAI.decisionInterval

How long between decisions, increasing this improves performance but makes the enemy less responsive.

◆ decisionTimer

float PlatformerPro.EnemyAI.decisionTimer
protected

Timer for tracking decision interval.

◆ enemy

Enemy PlatformerPro.EnemyAI.enemy
protected

Enemy reference.

Property Documentation

◆ ExtraSaveData

virtual string PlatformerPro.EnemyAI.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: