//Methods public void Reset() { mOpenList = new BinaryHeap(); mGrid = new BinaryGrid(); mGeneration = 1; mSolution = null; mGoal = null; }
//Methods public void Reset() { _movementList.Clear(); _openList.Clear(); _grid = new BinaryGrid <RouteNode>(); _nodeFactory.Clear(); _solution = null; _goal = null; }
//Constructors public Route() { _movementList = new MovementCostQueue(); _openList = new TotalCostQueue(); _grid = new BinaryGrid <RouteNode>(); _nodeFactory = new ListFactory <RouteNode>(); _terrain = new BinaryGrid <TerrainPoint>(); Reset(); _grain = 10; }
//Loop through each rectangle and create a terrain grid //Make sure grid has been cleared private void CreateTerrain(Point startPoint, Point endPoint) { if (mContainer == null) { return; } mTerrain = new BinaryGrid(); int terraincost = mGrain * mModifier * mTerrainCost; //Add all shapes if avoid is on, otherwise only the start and end if (Avoid) { foreach (Shape shape in mContainer.Shapes.Values) { //Reduce the terrain rectangle if rectangle intersection //and starting or ending shapes if (shape == Start || shape == End) { Rectangle rect = GetInflatedRectangle(shape); AddRectangleToTerrain(rect, terraincost); } else { Rectangle rect = GetInflatedRectangle(shape); if (!rect.Contains(startPoint) && !rect.Contains(endPoint)) { AddRectangleToTerrain(rect, terraincost); } } } } else { if (Start != null) { AddRectangleToTerrain(GetInflatedRectangle(Start), terraincost); } if (End != null) { AddRectangleToTerrain(GetInflatedRectangle(End), terraincost); } } }
//Loop through each rectangle and create a terrain grid //Make sure grid has been cleared private void CreateTerrain(Point startPoint, Point endPoint) { if (mContainer == null) return; mTerrain = new BinaryGrid(); int terraincost = mGrain * mModifier * mTerrainCost; //Add all shapes if avoid is on, otherwise only the start and end if (Avoid) { foreach (Shape shape in mContainer.Shapes.Values) { //Reduce the terrain rectangle if rectangle intersection //and starting or ending shapes if (shape == Start || shape == End) { Rectangle rect = GetInflatedRectangle(shape); AddRectangleToTerrain(rect, terraincost); } else { Rectangle rect = GetInflatedRectangle(shape); if (!rect.Contains(startPoint) && !rect.Contains(endPoint)) AddRectangleToTerrain(rect, terraincost); } } } else { if (Start != null) AddRectangleToTerrain(GetInflatedRectangle(Start), terraincost); if (End != null) AddRectangleToTerrain(GetInflatedRectangle(End), terraincost); } }
//Determines if the impassable structures must be recreated public void Reform() { mTerrain = null; }
//Methods public void Reset() { mOpenList = new BinaryHeap(); mGrid = new BinaryGrid(); mGeneration = 1; mSolution = null; mGoal = null; }
//Determines if the impassable structures must be recreated public void Reform() { mTerrain = null; }