private void Start() { score_ = FindObjectOfType <ScoreUI>(); flashlightRenderer_ = flashlight.GetComponent <SpriteRenderer>(); smackSound_ = FindObjectOfType <BumpsAndSounds>(); flashlightRenderer_.color = yellow_; strokeScript_ = FindObjectOfType <BallControl>(); player_ = GameObject.FindGameObjectWithTag("Player").transform; gangsterAnim_ = GetComponent <Animator>(); if (gangsterAnim_ == null) { Debug.LogError("no animator on: " + gameObject.name); } waypoints = new Vector3[pathHolder_.childCount]; for (int i = 0; i < waypoints.Length; i++) { waypoints[i] = pathHolder_.GetChild(i).position; waypoints[i] = new Vector3(waypoints[i].x, transform.position.y, waypoints[i].z); } targetWaypoint = waypoints[targetWaypointIndex]; transform.LookAt(targetWaypoint); StartCoroutine(FollowPath(waypoints)); }