PathEnemyFSM
This script implements an AI that will follow a set path, unless the player comes to close. Once the player is close enough it will follow the player until the player is out of range, or until the maximum distance away from the path is reached (if useLeash is set to true).
Public Variables
/// <summary> /// The player. /// </summary> public GameObject player;
/// <summary> /// The player tag. /// </summary> public string playerTag = "Player";
/// <summary> /// The path. /// </summary> public Transform[] path;
/// <summary> /// The chase start distance. /// </summary> public float chaseStartDistance = 1.0f;
/// <summary> /// The chase stop distance. /// </summary> public float chaseStopDistance = 2.0f;
/// <summary> /// The chase speed. /// </summary> public float chaseSpeed = 0.5f;
/// <summary> /// The rotate to path flag /// </summary> public bool rotateToPath = true;
/// <summary> /// The rotate speed. /// </summary> public float rotateSpeed = 5.0f;
/// <summary> /// The chase mode. (how to chase it) /// </summary> public PathEnemyChaseMode chaseMode = PathEnemyChaseMode.lerp;
/// <summary> /// The waypoint radius. /// </summary> public float waypointRadius = 0.1f;
/// <summary> /// The leash distance. /// </summary> public float leashDistance = 20.0f;
/// <summary> /// The use leash. /// </summary> public bool useLeash = true;
/// <summary> /// This flag indicates whether or not the scene is 2d or 3d. /// This affects how the rotation is calculated. /// </summary> public bool is2dScene = true;