public void RemoveTargetFromPool(string waypointPoolTag, GameObject target) { WaypointPool waypointPool = waypointPoolHandler.GetPoolByTag(waypointPoolTag, waypointPools); if (waypointPool == null) { return; } // Remove the target from the pool's target list and stop tracking it waypointPool.targets.Remove(target); waypointPoolHandler.StopTrackingTarget(target, poolDictionary[waypointPoolTag]); }
public void AddTargetToPool(string waypointPoolTag, GameObject target) { // Add the target to the correct waypool target list WaypointPool waypointPool = waypointPoolHandler.GetPoolByTag(waypointPoolTag, waypointPools); if (waypointPool == null) { return; } waypointPool.targets.Add(target); // Permanently increase the size of the pool until there are enough waypoints for every target while (waypointPool.targets.Count > waypointPool.size) { waypointPoolHandler.AddWaypointToPoolQueue(waypointPool, poolDictionary[waypointPoolTag], transform); } // Find an available waypoint to track the new target waypointPoolHandler.TrackNewTarget(target, poolDictionary[waypointPoolTag]); }