The sequence driven enemy allows you to create an enemy which has its movements decided in to distinct phases and states, and for you to set up the control between these phases and states. This is ideal for boss enemies but can also be used for other enemies.
The Sequenced Enemy has the same settings as found in a standard enemy. Expand the Basic Settings option to see them
The Sequenced Enemy has built in sense of sight and sense of proximity (effectively a simple hearing sense). When a character enters the sight or proximity they become the enemies current target.
Note: Sight is only a straight line ray cast not a cone. You can override the sense method to add more complex sensing capabilities.
Sight and Proximity senses have the following settings:
|Sight Distance||How far the enemy can see.|
|Sight Y Offset||The offset from the enemy transform from which the sight ray cast is sent.|
|Sight Layers||Layers to consider in the sight test. You would typically include both the Character and the geometry layers here unless you want the enemy to be able to see through walls.|
|Hearing Distance||How far the hearing/proximity sense travels.|
|Hearing Offset||The offset from the enemy transform from which the sight circle is cast.|
|Hearing Layers||Layers to hear, usually just the character layer.|
|Max Target Distance||When a targeted character moves outside of this range the target is lost.|
To view the sequence expand the Sequence field.
The sequence is divided in to phases and states:
Phase - A phase is a named and ordered group of states.
State - A state is a wrapper for an individual movement component. When the enemy is in a state it will use the selected movement.
On Start control starts at the first state of the first phase. Each state has an exit condition and when that condition is met, the control moves to the next state. If the state is the last state within a phase then the control moves back to the first state in the phase.
Before each state is executed the exit condition of the phase is checked. If this exit condition is met then control moves on to the next phase.
Warning: The last phase in the phase list should not have an exit condition.
Because its common for enemies to have additional conditions or loops within loops a GoTo option is included. At edit time GoTo states have a yellow background.
When a Goto state is reached its condition is evaluated. If the condition evaluates to true then the control moves to the phase and state indicated in the GoTo parameters. If not control moves to the next state in the phase.
The following exit types are available:
|Timer||The state or phase ends when a timer expires.|
|Timer plus Random||The state or phase is controlled by a timer but when the timer expires it will only end randomly with the chance (0 - 100%) specified in the properties. If the state doesn't end the timer is reset.|
|Move Complete||The state ends when the current movement completes. Works only for states which use a movement that is ICompletable. For example a melee attack.|
|Number of Hits||The state or phase ends when the enemy has been damaged a certain number of times.|
|Health Percentage||The state or phase ends when the enemies health reaches a certain percentage of its starting health.|
|Sense Player||The state or phase ends when the enemy is able to sense the player.|
|Lost Player Target||The state or phase ends when the enemy had a target and then subsequently loses it.|
|Target Within Range||The state or phase ends when the enemies target is within the specified range.|
|None||The state or phase does not end.|
|Always||The state always ends. This is intended for use on GoTo conditions and means the GoTo will always execute.|