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);