public RoutePersistentData[] GetEnemyRoutesCopy() { RoutePersistentData[] enemyRoutesCopy = null; RoutePersistentData originalEnemyRoute = null; RoutePersistentData newEnemyRoute = null; int length = 0; if (enemyRoutes != null) { length = enemyRoutes.Length; if (length > 0) { enemyRoutesCopy = new RoutePersistentData[length]; for (int i = 0; i < length; i++) { originalEnemyRoute = enemyRoutes[i]; if (originalEnemyRoute != null) { newEnemyRoute = new RoutePersistentData(); newEnemyRoute.SetAllWaypointIndexes(originalEnemyRoute.GetWaypointIndexesCopy()); } else { newEnemyRoute = null; } enemyRoutesCopy[i] = newEnemyRoute; } } } return(enemyRoutesCopy); }
public void AddRouteWaypointIndex(int newWaypointIndex) { if (routeIndexes == null) { routeIndexes = new RoutePersistentData(); } routeIndexes.AddWaypointIndex(newWaypointIndex); }
public void SetAllRouteWaypointIndexes(int[] newWaypointIndexes) { if (routeIndexes == null) { routeIndexes = new RoutePersistentData(); } routeIndexes.SetAllWaypointIndexes(newWaypointIndexes); if (routeIndexes.IsEmpty()) { ClearRoute(); } }
public void ClearRoute() { if (routeIndexes != null) { routeIndexes.Clear(); routeIndexes = null; } routeIDs = null; routePositions = null; routeReady = false; routeCompleted = false; }
protected override void Awake() { routeIndexes = null; routeIDs = null; routePositions = null; routeIndex = -1; targetPosX = 0f; targetPosY = 0f; targetReached = false; routeReady = false; routeCompleted = false; waitPosDuration = waitAtRoutePoint; waitPosDuration *= (waitPosDuration < 0f) ? -1f : 1f; waitPosElapsed = -1f; base.Awake(); }
public void PrintEnemyRoutes() { RoutePersistentData route = null; if (enemyRoutes != null) { for (int i = 0; i < enemyRoutes.Length; i++) { route = enemyRoutes[i]; Debug.Log("Debug : StructurePersistentData : Route " + i + ":"); if (route != null) { Debug.Log("Debug : StructurePersistentData : " + UsefulFunctions.StringFromArray <int>(", ", route.GetWaypointIndexesCopy())); } } } }
public void SetEnemyRoute(int enemyIndex, RoutePersistentData newEnemyRoute) { RoutePersistentData oldEnemyRoute = null; if (enemyRoutes != null) { if ((enemyIndex > -1) && (enemyIndex < enemyRoutes.Length)) { oldEnemyRoute = enemyRoutes[enemyIndex]; if (oldEnemyRoute != null) { oldEnemyRoute.Clear(); } enemyRoutes[enemyIndex] = newEnemyRoute; } } }
public void ClearEnemyRoutes() { RoutePersistentData routeData = null; if (enemyRoutes != null) { for (int i = 0; i < enemyRoutes.Length; i++) { routeData = enemyRoutes[i]; if (routeData != null) { routeData.Clear(); enemyRoutes[i] = null; } } enemyRoutes = null; } }