Graphics Reference
In-Depth Information
9.2 The Base AI Control Script
The BaseAIController.cs script includes the standard namespaces along with the addition
of AIStates, so that the AI controller can easily have access to the behavior enumerator list.
The full AI controller script looks like this:
using UnityEngine;
using System.Collections;
using AIStates;
[AddComponentMenu("Base/AI Controller")]
public class BaseAIController : ExtendedCustomMonoBehavior {
// AI states are defined in the AIStates namespace
private Transform proxyTarget;
private Vector3 relativeTarget;
private float targetAngle;
private RaycastHit hit;
private Transform tempTransform;
private Vector3 tempDirVec;
public float horz;
public float vert;
private int obstacleHitType;
// editor changeable / visible
public bool isStationary;
public AIState currentAIState;
public float patrolSpeed= 5f;
public float patrolTurnSpeed= 10f;
public float wallAvoidDistance= 40f;
public Transform followTarget;
public float modelRotateSpeed= 15f;
public int followTargetMaxTurnAngle= 120;
public float minChaseDistance= 2f;
public float maxChaseDistance= 10f;
public float visionHeightOffset= 1f;
[System.NonSerialized]
public Vector3 moveDirection;
// waypoint following related variables
public Waypoints_Controller myWayControl;
public int currentWaypointNum;
[System.NonSerialized]
public Transform currentWaypointTransform;
Search WWH ::




Custom Search