// Use this for initialization void Start () { nav = GetComponent<NavMeshAgent>(); sight = GetComponentInChildren<VillainSight>(); Transform wayPoints = GameObject.Find("Way Points").transform; int numWayPoints = wayPoints.childCount; patrolWayPoints = new Transform[numWayPoints]; for (int i = 0; i < numWayPoints; i++) { patrolWayPoints[i] = wayPoints.GetChild(i); } wayPointIndex = 0; patrolTimer = 0f; chaseTimer = 0f; chaseWarned = false; turnDirection = 1f; turnAngle = 0f; nav.enabled = false; transform.position = initialPosition; transform.rotation = initialRotation; nav.enabled = true; OnEnterHoldState(); }
// Use this for initialization void Start() { nav = GetComponent <NavMeshAgent>(); sight = GetComponentInChildren <VillainSight>(); Transform wayPoints = GameObject.Find("Way Points").transform; int numWayPoints = wayPoints.childCount; patrolWayPoints = new Transform[numWayPoints]; for (int i = 0; i < numWayPoints; i++) { patrolWayPoints[i] = wayPoints.GetChild(i); } wayPointIndex = 0; patrolTimer = 0f; chaseTimer = 0f; chaseWarned = false; turnDirection = 1f; turnAngle = 0f; nav.enabled = false; transform.position = initialPosition; transform.rotation = initialRotation; nav.enabled = true; OnEnterHoldState(); }