I personally like to use the idea of states. The idea being that a unit ( in this case your enemy ) is always in a state of existence. Possible states could be:
- "Idle" ( sitting there doing nothing )
- "Patrolling" ( maybe going back and forth between 2 points on the map )
- "AwareOfPlayer" ( possibly looking at the player/paying attention to what the player is doing )
- "AttackPlayer" ( actively trying to damage the player )
- "ReactToDamage" ( reacting to taking damage from the player )
- etc, etc
Then its just a matter of putting together whatever conditions you want to have met, to trigger a new state. Like getting hit by a player bullet would trigger "ReactToDamage" for example. The player being too far away from an enemy might mean the enemy defaults to "Idle" or "Patrolling". Perhaps an enemy that is "Patrolling" will stop sometimes and be "Idle" for a few seconds and then go back to "Patrolling" again. The possibilities are pretty much limitless :)