//----------------- GetTerrainCost --------------------------------------- // // returns the cost of the terrain represented by the current brush type //------------------------------------------------------------------------ public double GetTerrainCost(brush_type brush) { const double cost_normal = 1.0; const double cost_water = 2.0; const double cost_mud = 1.5; switch (brush) { case brush_type.normal: return(cost_normal); case brush_type.water: return(cost_water); case brush_type.mud: return(cost_mud); default: return(Double.MaxValue); } ; }
public PathFinder() { m_bShowGraph = false; m_bShowTiles = true; m_dCellWidth = 0; m_dCellHeight = 0; m_iCellsX = 0; m_iCellsY = 0; m_dTimeTaken = 0.0; m_CurrentTerrainBrush = brush_type.normal; m_iSourceCell = -1; m_iTargetCell = -1; m_icxClient = 0; m_icyClient = 0; m_dCostToTarget = 0.0; m_Graph = null; m_ThickBlack = new Pen(Color.Black, 2); m_ThickBlue = new Pen(Color.Blue, 2); m_font = new Font("Arial", 8, FontStyle.Regular); }
//----------------- GetTerrainCost --------------------------------------- // // returns the cost of the terrain represented by the current brush type //------------------------------------------------------------------------ public double GetTerrainCost(brush_type brush) { const double cost_normal = 1.0; const double cost_water = 2.0; const double cost_mud = 1.5; switch (brush) { case brush_type.normal: return cost_normal; case brush_type.water: return cost_water; case brush_type.mud: return cost_mud; default: return Double.MaxValue; }; }