void Spawn() { flightOrder = enemiesController.FlightOrder(); if (flightOrder) { heading = waypoints.GetWaypoint(headingIndex).transform; } else { heading = waypoints.GetRNGWaypoint().transform; } NewDirection(); }
void Start() { // grab components //enemiesController = GameObject.Find("Enemies").GetComponent<EnemiesController>(); enemiesController = transform.parent.GetComponent <EnemiesController>(); waypoints = enemiesController.GetWaypoinmts(); //waypoints = GameObject.Find("Waypoints").GetComponent<Waypoints>(); RB = GetComponent <Rigidbody2D>(); eSpeed = enemiesController.GetEnemySpeed(); headingIndex = 0; waypointThreshold = 5f; flightOrder = enemiesController.FlightOrder(); if (flightOrder) { heading = waypoints.GetWaypoint(headingIndex).transform; } else { heading = waypoints.GetRNGWaypoint().transform; } NewDirection(); //Spawn(); }