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

An enemy that has a sequence of moves which happen in order (can loop). More...

Inheritance diagram for PlatformerPro.SequenceDrivenEnemy:
PlatformerPro.Enemy PlatformerPro.IMob PlatformerPro.PersistableObject PlatformerPro.IMob PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

virtual void ChangeState (int newState)
 Changes the state. You can also call from your own code to force a state change. More...
 
virtual void ChangePhase (int newPhase, int newState)
 Changes the phase. You can also call from your own code to froce phase change. More...
 
override void Damage (DamageInfo info)
 Damage the enemy with the specified damage information. More...
 
override void MovementComplete ()
 Called when the enemies current attack finished More...
 
- Public Member Functions inherited from PlatformerPro.Enemy
virtual void OnChangeAnimationState ()
 Raises the change animation state event. This version is public as it just triggers an update not a change. More...
 
virtual void OnEnemyAIEvent (string eventName)
 Raises an enemy AI event. More...
 
virtual void SwitchDirection ()
 Call this to switch the direction of all associated movements. More...
 
virtual void HitCharacter (Character character, DamageInfo info)
 Called when the enemy hits the character causing damage. More...
 
virtual void AttackFinished ()
 Called when the enemies current attack finished More...
 
virtual void Reset ()
 Reset this instance. More...
 
virtual void Heal (int amount)
 Heal the enemy by the specified amount. More...
 
virtual void SetHealth (int amount)
 Heal the enemy by the specified amount. More...
 
virtual void Die (DamageInfo info)
 Kill the enemy. More...
 
virtual void Translate (float x, float y, bool applyYTransformsInWorldSpace)
 Translate the character by the supplied amount. More...
 
virtual void AddVelocity (float x, float y)
 Adds velocity. More...
 
virtual void SetVelocityX (float x)
 Sets X velocity. More...
 
virtual void SetVelocityY (float y)
 Sets Y velocity. More...
 
virtual void AddAnimationOverride (string overrideState)
 Adds an animation override. NOTE: Currently only one override is supported at a time. Note overrides are used to refer to an animator or layer override (depending on animation type) not forcing the override of a single animation which is done with ForceAnimation(). More...
 
virtual void RemoveAnimationOverride (string overrideState)
 Removes an animation override. NOTE: Currently only one override is supported at a time. More...
 
virtual void ApplyGravity ()
 Applies the gravity. More...
 
virtual void MakeInvulnerable (float invulnerableTime)
 Makes the enemy invulnerable for the given number of settings. More...
 
virtual void MakeVulnerable ()
 Makes the enemy vulnerable. More...
 
virtual void ApplyFeetCollisions ()
 Applies the feet collisions. More...
 
virtual void ApplySideCollisions ()
 Applies the Side collisions. More...
 
virtual bool IsColliderIgnored (Collider2D collider)
 Check if a given collider should be ignored in collisions. More...
 
virtual void AddIgnoredCollider (Collider2D collider)
 Adds a collider to the list of ignored colliders. More...
 
virtual void RemoveIgnoredCollider (Collider2D collider)
 Removes a collider from the list of ignored colliders. More...
 
- Public Member Functions inherited from PlatformerPro.PersistableObject
void SetPersistenceState (bool state)
 Sets the persistence state. More...
 
void SetPersistenceState (bool state, string extraPersistenceData)
 Sets the persistence state, overriding extra persistence data 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 sightDistance = 5.0f
 How far can the enemy see? More...
 
float sightYOffset
 Y position of the characters 'eyes'. More...
 
LayerMask sightLayers
 Layers to check for obstacle and characters. More...
 
float hearingRadius = 1.0f
 Range of the proximity sense. More...
 
Vector2 hearingOffset
 Centre point of the proximity sense. More...
 
LayerMask hearingLayers
 Layers to check for proximity sense. More...
 
float maxTargetDistance
 LDistance at which the target is "lost". More...
 
List< EnemyPhasephaseInfo
 List of the states in the sequence. More...
 
List< EnemyStateInfoglobalGotos
 List of GOTO conditions that are evaluated every loop. More...
 
- Public Attributes inherited from PlatformerPro.Enemy
int health = 1
 Enemies health. More...
 
bool continueMovementOnDamage
 If true the movement system will control damage. Generally used for Graph based enemy AI. More...
 
float invulnerableTime = 0.5f
 How long the enemy is invulnerable to damage after being hit. More...
 
float damageTime = 0.5f
 How long the enemy in the damaged movement after being hit. More...
 
bool continueMovementOnFall
 Should movements keep moving while falling. More...
 
bool switchCollidersOnDirectionChange
 Should we switch colliders when the enemy changes direction (used for asymmetric characters). More...
 
int startFacingDirection = 1
 The facing direction on start. Typically 1 or -1. More...
 
bool enemyInteractsWithPlatforms
 Does this enemy interact with platforms? More...
 
LayerMask geometryLayerMask
 The layers that are considered when working out collisions. i.e. the things we can't move through. More...
 
bool characterCanFall
 Does the character fall if there is no platform below it? More...
 
float terminalVelocity = -15f
 Maximum fall speed (note that any individual movement may override this if it wants to). More...
 
bool useCharacterGravity
 Should we use the characters gravity or a custom one. More...
 
float customGravity = -15f
 Custom gravity. More...
 
float feetHeight
 If the cahracter can fall where are its feet in y? More...
 
float groundedLookAhead
 How far do we look ahead when determining if we are grounded. More...
 
float feetWidth
 If the cahracter can fall where are its feet in x (offset from centre)? More...
 
bool detectSideCollisions
 Does the character detect side collisions? More...
 
float sideHeight
 The height of the side collisions. More...
 
float sideWidth
 The width of the side collisions. More...
 
bool switchDirectionOnSideHit
 If the charcter runs in to the wall should it switch direciton on all movements? More...
 
bool useDefaultPersistence
 Does this Item get persistence defaults form the Game manager? More...
 
PersistableEnemyType enemyPersistenceImplementation
 How do we implement the persistence settings. More...
 
RaycastHit2D[] leftFeetCollisions
 Stores left foot collissions. More...
 
RaycastHit2D[] rightFeetCollisions
 Stores right foot collissions. More...
 
- Public Attributes inherited from PlatformerPro.PersistableObject
bool enablePersistence
 Should we enable persistence? More...
 
string guid = System.Guid.NewGuid().ToString()
 Unique ID for this object. You shoulnd't need to edit this, use editor debug mode if you must. More...
 
GameObject target
 GameObject to apply persitence settings to, defaults to self. More...
 
PersistableObjectType persistenceImplementation
 How do we implement the persistence settings. More...
 
bool defaultStateIsDisabled
 If true then the obejct starts disabled. More...
 
string spawnedObjectName
 If this item was spawned then save the name of the prefab here. More...
 

Protected Member Functions

virtual void OnPhaseEnter ()
 Raises the phase enter event. More...
 
virtual void OnPhaseExit ()
 Raises the phase exit event. More...
 
virtual void OnStateEnter ()
 Raises the state enter event. More...
 
virtual void OnStateExit ()
 Raises the state exit event. More...
 
override void PostInit ()
 Set up the character More...
 
override void DoUpdate ()
 Run each frame to determine and execute move. More...
 
override void DecideOnNextMovement ()
 Decides on the next movement. Here we use the state sequence. More...
 
virtual bool CheckStateExitCondition (EnemyStateInfo currentState)
 Checks if the states exit condition has been met. More...
 
virtual bool CheckPhaseExitCondition (EnemyPhase currentPhase)
 Checks if the phase exit condition has been met. More...
 
virtual bool CheckForCharacter ()
 Try to find a character by looking and listening. More...
 
virtual bool See ()
 Look for a character. More...
 
virtual bool Hear ()
 Listen for a character. More...
 
- Protected Member Functions inherited from PlatformerPro.Enemy
virtual void OnDamaged (DamageInfo info)
 Raises the damaged event. More...
 
virtual void OnDied (DamageInfo info)
 Raises the died event. More...
 
virtual void OnCollided (DamageInfo info)
 Raises the collided event. More...
 
virtual void OnChangeAnimationState (AnimationState state, AnimationState previousState)
 Raises the change animation state event. More...
 
virtual void OnChangeAnimationState (AnimationState state, AnimationState previousState, int priority)
 Raises the change animation state event. More...
 
virtual void OnCharacterDamaged (DamageInfo info)
 Raises the hit character event. More...
 
virtual void OnMovementHasCompleted ()
 Raises the MovementHasCompleted Event. More...
 
override void SetPersistenceDefaults ()
 Sets the persistence defaults. More...
 
virtual void HandleWillExitScene (object sender, SceneEventArgs e)
 Handles the will exit scene event. used to save data. More...
 
virtual void SwitchColliders ()
 Switches left and right collider direction and flips position of all colliders about y axis. More...
 
virtual void DoBaseCollisions ()
 Does the base collisions. More...
 
override void ApplyCustomPersistence (PersistableObjectData data)
 Custom persistable implementation. Override to customise. More...
 
virtual void SavePersistenceData ()
 Gets the extra persistence data which is used to save enemy state. NOTE: Generally you should override ExtraPersistenceData to save a different set of data. More...
 
- Protected Member Functions inherited from PlatformerPro.PersistableObject
virtual void ProcessState ()
 Processes the persisted state. More...
 
virtual void ApplyExtraPersistenceData (PersistableObjectData data)
 Apply any extra data. This differs from custom persistence, as custom persistence must control both data and ctivation state. More...
 

Protected Attributes

int currentPhase
 The currently active phase. More...
 
int currentState
 The currently active state. More...
 
float phaseTimer
 Stores how long we have been in current phase. If the same state is played multiple times this tracks the time in the CURRENT iteration. More...
 
int phaseLoopCount
 Tracks how many times we have played the current phase. More...
 
int phaseHitCount
 Stores the number of times we have been damaged while in current phase. More...
 
float stateTimer
 Stores how long we have been in current state. If the same state is played multiple times this tracks the time in the CURRENT iteration. More...
 
bool stateMovementComplete
 Stores the completion state of current move. More...
 
int stateHitCount
 Stores the number of times we have been damaged while in current state. More...
 
int infiniteLoopCheck
 Tracks how many times we have changed state in a frame, if its too many this is likely a loop. More...
 
Collider2D[] proximityColliders
 Used to store results of hearing overlap call. More...
 
bool willExitState
 Tracks if exit condition for state has been met. More...
 
bool willExitPhase
 Tracks if exit condition for phase has been met. More...
 
bool hasRunCheckForCharacter
 Track if we have run the check for player call so we don't eat resources by running it more than once a frame. More...
 
bool checkForCharacterResult
 Result of the last check for character. More...
 
CharacterHealth currentTargetHealth
 Cached character health for current target. More...
 
float startingHealth
 Capture starting health in case we need to calcualte based on health percentage. More...
 
- Protected Attributes inherited from PlatformerPro.Enemy
Transform myTransform
 Cached copy of the enemies transform. More...
 
EnemyMovement movement
 Reference to the class that controls the enemy movement. More...
 
EnemyMovement damageMovement
 Reference to the class that controls the enemy damage movement. More...
 
EnemyMovement deathMovement
 Reference to the class that controls the enemy death movement. More...
 
AnimationState animationState
 The enemies current animation state. More...
 
string overrideState
 The enemies current animation overridestate. More...
 
AnimationEventArgs animationEventArgs
 A cached animation event args that we update so we don't need to allocate. More...
 
bool Active = true
 Is this enemy active? More...
 
float invulnerableTimer = -1.0f
 Timer for invulnerability. Character is invulnerable when this is greater than zero. More...
 
DamageInfoEventArgs damageEventArgs
 Cached copy of damage event args to save on allocations. More...
 
EnemyAI enemyAi
 The enemy ai (can be null meaning only movements will control the character). More...
 
int currentFacingDirection
 The direction currently faced. Used for switch collider calculations and for AI that needs actual facing direction. More...
 
Transform[] collidersForSwitching
 If we switch colliders when the character turns this is the list of transforms of Collider2D's to switch. More...
 
NoAllocationSmartFeetcast rightFoot
 The right foot collider. More...
 
NoAllocationSmartFeetcast leftFoot
 The left foot collider. More...
 
NoAllocationSmartSidecast rightSide
 The right side collider. More...
 
NoAllocationSmartSidecast leftSide
 The left side collider. More...
 
Character characterForGravity
 If gravity comes from a character reference this is the gravity we are using. More...
 
bool grounded
 Is the enemy grounded. More...
 
float ignoredSlope
 The angle of the ignored slope. More...
 
PlatformCollisionArgs platformCollisionArgs
 The platform collision arguments. More...
 
Platform parentPlatform
 Stores the aprent platform if we have one. More...
 
Character currentTarget
 The current target. More...
 
HashSet< Collider2D > ignoredColliders
 A list of colliders to ingore during collisions. More...
 

Static Protected Attributes

const int MaxStateChanges = 20
 Maximum number of state changes in a frame. More...
 
- Static Protected Attributes inherited from PlatformerPro.Enemy
const float MAX_ENEMY_SLOPE = 60.0f
 Max slope an enemy will calcualte/walk on More...
 
const float DefaultSideLookAhead = 0.05f
 Default side look ahead. More...
 

Properties

int CurrentPhase [get]
 Gets the index of the current phase. More...
 
int CurrentState [get]
 Gets the index of the current state. More...
 
- Properties inherited from PlatformerPro.Enemy
override string Header [get]
 
virtual Transform Transform [get]
 Gets cache copy of the transform. More...
 
virtual int FacingDirection [get]
 Returns the direction the enemy is facing. 0 for none, 1 for right, -1 for left. More...
 
virtual AnimationState AnimationState [get, protected set]
 The enemies current animation state. More...
 
virtual string OverrideState [get, protected set]
 The enemies current animation override state. More...
 
virtual Vector2 Velocity [get, set]
 The characters velocity. More...
 
virtual Vector2 PreviousVelocity [get, set]
 The characters velocity in the previous frame. More...
 
virtual bool IsInvulnerable [get]
 Is the character currently invulnerable? More...
 
virtual EnemyState State [get, protected set]
 The current AI state. More...
 
int StartingHealth [get, protected set]
 Health the enemy started with More...
 
virtual int? LastFacedDirection [get]
 Returns the direction the character is facing, but if direction is currently 0 instead returns the direction last faced. More...
 
virtual float SlopeTargetRotation [get, protected set]
 If slopes are on this is the rotation we are rotating towards. More...
 
virtual float SlopeActualRotation [get]
 If slopes are on this is the rotation we are currently on. More...
 
virtual float PreviousRotation [get, set]
 The characters rotation in the previous frame. More...
 
virtual float IgnoredSlope [get, set]
 Gets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame. More...
 
virtual float MinSideAngle [get]
 Gets the minimum angle at which geometry is considered a wall. More...
 
virtual int ZLayer [get, set]
 Gets or sets the characters current z layer. More...
 
virtual EnemyAI AI [get]
 Gets the enemy AI or null if there is no AI. More...
 
virtual bool Grounded [get]
 Returns true if we are grounded or false otherwise. More...
 
virtual bool GroundedLeft [get, protected set]
 Returns true if we are grounded on the left foot. More...
 
virtual bool GroundedRight [get, protected set]
 Returns true if we are grounded on the left foot. More...
 
virtual int GroundLayer [get, protected set]
 If grounded this is the layer of the ground. Undefined if not grounded. More...
 
virtual float? Gravity [get]
 Gravity for this enemy More...
 
virtual EnemyMovement CurrentMovement [get]
 Gets the current movement or null if no movement is acgtive (for example when falling with continueMovementOnFall off). More...
 
virtual float Friction [get, set]
 Gets the friction. More...
 
virtual Transform CurrentTargetTransform [get]
 The current targets position or enemies position if no target found. More...
 
virtual Character CurrentTarget [get, set]
 The current target. More...
 
override string ExtraPersistenceData [get]
 Gets the extra persistence data. More...
 
virtual EnemyPersistenceData ExtraPersistenceDataAsObject [get]
 Gets the extra persistence data in object form which is used to save enemy state. More...
 
- Properties inherited from PlatformerPro.PersistableObject
virtual string ExtraPersistenceData [get]
 Gets the extra persistence data. 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...
 
- Properties inherited from PlatformerPro.IMob
AnimationState AnimationState [get]
 The current animation state. More...
 
int FacingDirection [get]
 Returns the direction being faced. 0 for none, 1 for right, -1 for left. More...
 
int LastFacedDirection [get]
 Returns the direction being faced, but if direction is currently 0 instead returns the direction last faced. More...
 
Vector2 Velocity [get]
 The characters velocity relative to self. More...
 
Vector2 PreviousVelocity [get]
 The characters velocity in the previous frame relative to self. More...
 
float SlopeTargetRotation [get]
 If slopes are on this is the rotation we are rotating towards. More...
 
float SlopeActualRotation [get]
 If slopes are on this is the rotation we are currently on. More...
 
float PreviousRotation [get]
 If slopes are on this is the rotation we were at last frame. More...
 
float IgnoredSlope [get, set]
 Gets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame. More...
 
float MinSideAngle [get]
 Gets the minimum angle at which geometry is considered a wall. More...
 
int ZLayer [get, set]
 Gets or sets the characters current z layer. More...
 
bool Grounded [get]
 Returns true if we are grounded or false otherwise. More...
 
int GroundLayer [get]
 If grounded this is the layer of the ground. Undefined if not grounded. More...
 
float Gravity [get]
 Gravity currently acting on the character. More...
 
float Friction [get, set]
 Gets the friction. More...
 

Events

System.EventHandler< SequenceEnemyPhaseEventArgsPhaseEnter
 Event for anmation state changes. More...
 
System.EventHandler< SequenceEnemyPhaseEventArgsPhaseExit
 Event for damage. More...
 
System.EventHandler< StateEventArgsStateEnter
 Event for anmation state changes. More...
 
System.EventHandler< StateEventArgsStateExit
 Event for state exit. More...
 
- Events inherited from PlatformerPro.Enemy
System.EventHandler< AnimationEventArgsChangeAnimationState
 Event for anmation state changes. More...
 
System.EventHandler< DamageInfoEventArgsDamaged
 Event for damage. More...
 
System.EventHandler< DamageInfoEventArgsDied
 Event for death. More...
 
System.EventHandler< DamageInfoEventArgsCollided
 Event for being hit but not damaged. More...
 
System.EventHandler< DamageInfoEventArgsCharacterDamaged
 Event for damaging a character. More...
 
System.EventHandler< EmptyEventArgsMovementHasCompleted
 Event sent when current movement completes. More...
 
System.EventHandler< EnemyAIEventArgsEnemyAIEvent
 A generic event sent by an enemy AI. More...
 
- Events inherited from PlatformerPro.IMob
System.EventHandler< AnimationEventArgsChangeAnimationState
 Event for anmation state changes. More...
 

Detailed Description

An enemy that has a sequence of moves which happen in order (can loop).

Member Function Documentation

◆ ChangePhase()

virtual void PlatformerPro.SequenceDrivenEnemy.ChangePhase ( int  newPhase,
int  newState 
)
virtual

Changes the phase. You can also call from your own code to froce phase change.

Parameters
newPhaseNew phase.
newStateNew state.

◆ ChangeState()

virtual void PlatformerPro.SequenceDrivenEnemy.ChangeState ( int  newState)
virtual

Changes the state. You can also call from your own code to force a state change.

Parameters
newStateNew state index.

◆ CheckForCharacter()

virtual bool PlatformerPro.SequenceDrivenEnemy.CheckForCharacter ( )
protectedvirtual

Try to find a character by looking and listening.

Returns
true, if for character was checked, false otherwise.

◆ CheckPhaseExitCondition()

virtual bool PlatformerPro.SequenceDrivenEnemy.CheckPhaseExitCondition ( EnemyPhase  currentPhase)
protectedvirtual

Checks if the phase exit condition has been met.

Returns
true, if exit condition was checked, false otherwise.

◆ CheckStateExitCondition()

virtual bool PlatformerPro.SequenceDrivenEnemy.CheckStateExitCondition ( EnemyStateInfo  currentState)
protectedvirtual

Checks if the states exit condition has been met.

Returns
true, if exit condition was checked, false otherwise.
Parameters
enemyEnemy.
stateTImerTime we have been in this state.

◆ Damage()

override void PlatformerPro.SequenceDrivenEnemy.Damage ( DamageInfo  info)
virtual

Damage the enemy with the specified damage information.

Parameters
infoThe damage info.

Reimplemented from PlatformerPro.Enemy.

◆ DecideOnNextMovement()

override void PlatformerPro.SequenceDrivenEnemy.DecideOnNextMovement ( )
protectedvirtual

Decides on the next movement. Here we use the state sequence.

Reimplemented from PlatformerPro.Enemy.

◆ DoUpdate()

override void PlatformerPro.SequenceDrivenEnemy.DoUpdate ( )
protectedvirtual

Run each frame to determine and execute move.

Reimplemented from PlatformerPro.Enemy.

◆ Hear()

virtual bool PlatformerPro.SequenceDrivenEnemy.Hear ( )
protectedvirtual

Listen for a character.

◆ MovementComplete()

override void PlatformerPro.SequenceDrivenEnemy.MovementComplete ( )
virtual

Called when the enemies current attack finished

Reimplemented from PlatformerPro.Enemy.

◆ OnPhaseEnter()

virtual void PlatformerPro.SequenceDrivenEnemy.OnPhaseEnter ( )
protectedvirtual

Raises the phase enter event.

◆ OnPhaseExit()

virtual void PlatformerPro.SequenceDrivenEnemy.OnPhaseExit ( )
protectedvirtual

Raises the phase exit event.

◆ OnStateEnter()

virtual void PlatformerPro.SequenceDrivenEnemy.OnStateEnter ( )
protectedvirtual

Raises the state enter event.

◆ OnStateExit()

virtual void PlatformerPro.SequenceDrivenEnemy.OnStateExit ( )
protectedvirtual

Raises the state exit event.

◆ PostInit()

override void PlatformerPro.SequenceDrivenEnemy.PostInit ( )
protectedvirtual

Set up the character

Reimplemented from PlatformerPro.Enemy.

◆ See()

virtual bool PlatformerPro.SequenceDrivenEnemy.See ( )
protectedvirtual

Look for a character.

Member Data Documentation

◆ checkForCharacterResult

bool PlatformerPro.SequenceDrivenEnemy.checkForCharacterResult
protected

Result of the last check for character.

◆ currentPhase

int PlatformerPro.SequenceDrivenEnemy.currentPhase
protected

The currently active phase.

◆ currentState

int PlatformerPro.SequenceDrivenEnemy.currentState
protected

The currently active state.

◆ currentTargetHealth

CharacterHealth PlatformerPro.SequenceDrivenEnemy.currentTargetHealth
protected

Cached character health for current target.

◆ globalGotos

List<EnemyStateInfo> PlatformerPro.SequenceDrivenEnemy.globalGotos

List of GOTO conditions that are evaluated every loop.

◆ hasRunCheckForCharacter

bool PlatformerPro.SequenceDrivenEnemy.hasRunCheckForCharacter
protected

Track if we have run the check for player call so we don't eat resources by running it more than once a frame.

◆ hearingLayers

LayerMask PlatformerPro.SequenceDrivenEnemy.hearingLayers

Layers to check for proximity sense.

◆ hearingOffset

Vector2 PlatformerPro.SequenceDrivenEnemy.hearingOffset

Centre point of the proximity sense.

◆ hearingRadius

float PlatformerPro.SequenceDrivenEnemy.hearingRadius = 1.0f

Range of the proximity sense.

◆ infiniteLoopCheck

int PlatformerPro.SequenceDrivenEnemy.infiniteLoopCheck
protected

Tracks how many times we have changed state in a frame, if its too many this is likely a loop.

◆ MaxStateChanges

const int PlatformerPro.SequenceDrivenEnemy.MaxStateChanges = 20
staticprotected

Maximum number of state changes in a frame.

◆ maxTargetDistance

float PlatformerPro.SequenceDrivenEnemy.maxTargetDistance

LDistance at which the target is "lost".

◆ phaseHitCount

int PlatformerPro.SequenceDrivenEnemy.phaseHitCount
protected

Stores the number of times we have been damaged while in current phase.

◆ phaseInfo

List<EnemyPhase> PlatformerPro.SequenceDrivenEnemy.phaseInfo

List of the states in the sequence.

◆ phaseLoopCount

int PlatformerPro.SequenceDrivenEnemy.phaseLoopCount
protected

Tracks how many times we have played the current phase.

◆ phaseTimer

float PlatformerPro.SequenceDrivenEnemy.phaseTimer
protected

Stores how long we have been in current phase. If the same state is played multiple times this tracks the time in the CURRENT iteration.

◆ proximityColliders

Collider2D [] PlatformerPro.SequenceDrivenEnemy.proximityColliders
protected

Used to store results of hearing overlap call.

◆ sightDistance

float PlatformerPro.SequenceDrivenEnemy.sightDistance = 5.0f

How far can the enemy see?

◆ sightLayers

LayerMask PlatformerPro.SequenceDrivenEnemy.sightLayers

Layers to check for obstacle and characters.

◆ sightYOffset

float PlatformerPro.SequenceDrivenEnemy.sightYOffset

Y position of the characters 'eyes'.

◆ startingHealth

float PlatformerPro.SequenceDrivenEnemy.startingHealth
protected

Capture starting health in case we need to calcualte based on health percentage.

◆ stateHitCount

int PlatformerPro.SequenceDrivenEnemy.stateHitCount
protected

Stores the number of times we have been damaged while in current state.

◆ stateMovementComplete

bool PlatformerPro.SequenceDrivenEnemy.stateMovementComplete
protected

Stores the completion state of current move.

◆ stateTimer

float PlatformerPro.SequenceDrivenEnemy.stateTimer
protected

Stores how long we have been in current state. If the same state is played multiple times this tracks the time in the CURRENT iteration.

◆ willExitPhase

bool PlatformerPro.SequenceDrivenEnemy.willExitPhase
protected

Tracks if exit condition for phase has been met.

◆ willExitState

bool PlatformerPro.SequenceDrivenEnemy.willExitState
protected

Tracks if exit condition for state has been met.

Property Documentation

◆ CurrentPhase

int PlatformerPro.SequenceDrivenEnemy.CurrentPhase
get

Gets the index of the current phase.

◆ CurrentState

int PlatformerPro.SequenceDrivenEnemy.CurrentState
get

Gets the index of the current state.

Event Documentation

◆ PhaseEnter

System.EventHandler<SequenceEnemyPhaseEventArgs> PlatformerPro.SequenceDrivenEnemy.PhaseEnter

Event for anmation state changes.

◆ PhaseExit

System.EventHandler<SequenceEnemyPhaseEventArgs> PlatformerPro.SequenceDrivenEnemy.PhaseExit

Event for damage.

◆ StateEnter

System.EventHandler<StateEventArgs> PlatformerPro.SequenceDrivenEnemy.StateEnter

Event for anmation state changes.

◆ StateExit

System.EventHandler<StateEventArgs> PlatformerPro.SequenceDrivenEnemy.StateExit

Event for state exit.


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