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

Enemy AI which ocassionally runs back and forward within a designated area, and if it sees the player shoots at it. More...

Inheritance diagram for PlatformerPro.EnemyAI_SeeAndShoot:
PlatformerPro.EnemyAI PlatformerPro.PlatformerProMonoBehaviour PlatformerPro.EnemyAI_SeeAndShootWithHide PlatformerPro.EnemyAI_SenseAndShoot

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...
 
- 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 DamageInfo DoDamage (DamageInfo info)
 Handle damage. 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 sightDistance = 5.0f
 How far can the enemy see? More...
 
float yOffset
 Y position of the characters 'eyes'. More...
 
LayerMask sightLayers
 Layers to check for obstacle and characters. More...
 
float shootStateTime
 How long to keep shooting at player before going back to the default state. More...
 
int activityRate
 How often will the character walk about from 0 - never, to 1 - always. 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 Attributes

Transform myTransform
 Cached transform reference. More...
 
float shootStateTimer
 Counts down from shootStateTime when the player is seen. When non zero the character will be in the shooting state. More...
 
Vector3 offset
 Store the offset to apply to the sight raycast. More...
 
- Protected Attributes inherited from PlatformerPro.EnemyAI
float decisionTimer
 Timer for tracking decision interval. More...
 
Enemy enemy
 Enemy reference. More...
 

Additional Inherited Members

- 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 ocassionally runs back and forward within a designated area, and if it sees the player shoots at it.

Member Function Documentation

◆ Decide()

override EnemyState PlatformerPro.EnemyAI_SeeAndShoot.Decide ( )
virtual

Decide the next move

Reimplemented from PlatformerPro.EnemyAI.

Reimplemented in PlatformerPro.EnemyAI_SeeAndShootWithHide.

◆ Init()

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

◆ Sense()

override bool PlatformerPro.EnemyAI_SeeAndShoot.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.

Reimplemented in PlatformerPro.EnemyAI_SenseAndShoot, and PlatformerPro.EnemyAI_SeeAndShootWithHide.

Member Data Documentation

◆ activityRate

int PlatformerPro.EnemyAI_SeeAndShoot.activityRate

How often will the character walk about from 0 - never, to 1 - always.

◆ myTransform

Transform PlatformerPro.EnemyAI_SeeAndShoot.myTransform
protected

Cached transform reference.

◆ offset

Vector3 PlatformerPro.EnemyAI_SeeAndShoot.offset
protected

Store the offset to apply to the sight raycast.

◆ shootStateTime

float PlatformerPro.EnemyAI_SeeAndShoot.shootStateTime

How long to keep shooting at player before going back to the default state.

◆ shootStateTimer

float PlatformerPro.EnemyAI_SeeAndShoot.shootStateTimer
protected

Counts down from shootStateTime when the player is seen. When non zero the character will be in the shooting state.

◆ sightDistance

float PlatformerPro.EnemyAI_SeeAndShoot.sightDistance = 5.0f

How far can the enemy see?

◆ sightLayers

LayerMask PlatformerPro.EnemyAI_SeeAndShoot.sightLayers

Layers to check for obstacle and characters.

◆ yOffset

float PlatformerPro.EnemyAI_SeeAndShoot.yOffset

Y position of the characters 'eyes'.


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