Exemple #1
0
    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);
    }
Exemple #2
0
 public void AddRouteWaypointIndex(int newWaypointIndex)
 {
     if (routeIndexes == null)
     {
         routeIndexes = new RoutePersistentData();
     }
     routeIndexes.AddWaypointIndex(newWaypointIndex);
 }
Exemple #3
0
 public void SetAllRouteWaypointIndexes(int[] newWaypointIndexes)
 {
     if (routeIndexes == null)
     {
         routeIndexes = new RoutePersistentData();
     }
     routeIndexes.SetAllWaypointIndexes(newWaypointIndexes);
     if (routeIndexes.IsEmpty())
     {
         ClearRoute();
     }
 }
Exemple #4
0
 public void ClearRoute()
 {
     if (routeIndexes != null)
     {
         routeIndexes.Clear();
         routeIndexes = null;
     }
     routeIDs       = null;
     routePositions = null;
     routeReady     = false;
     routeCompleted = false;
 }
Exemple #5
0
 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();
 }
Exemple #6
0
    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()));
                }
            }
        }
    }
Exemple #7
0
    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;
            }
        }
    }
Exemple #8
0
    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;
        }
    }