ZionGames Docs

Home / ZionRPG

โš”๏ธ ZionRPG

RPG Framework ยท RPGFramework Namespace ยท Unity 6

Enemy AI โ€” Phase 9

The enemy AI system provides a state machine-based controller for NPC enemies, with support for patrol routes, player detection, and combat.

๐Ÿ“„ Full tutorial available as a Word document Download .docx

EnemyAIController MonoBehaviour

State machine controller. States: Idle, Patrol, Chase, Attack, Dead.

PropertyTypeDescription
detectionRadiusfloatSphere radius for player detection
attackRangefloatDistance at which attack state triggers
patrolPointsTransform[]Waypoints for patrol route
CurrentStateAIStateRead-only current state enum value
State transition from external code
// Force the enemy into alert state
enemyAI.TransitionTo(AIState.Chase);