Пример #1
0
 /// <summary>
 ///     Returns the state of the cell for a given coordinate
 /// </summary>
 /// <param name="coordinate"></param>
 /// <returns></returns>
 public CellState GetCellState(Coordinate3D coordinate)
 {
     return(Cells[coordinate]);
 }
Пример #2
0
 /// <summary>
 ///     Finds shortest path from the start to the goal. Requires pawn's movement type to operate
 /// </summary>
 /// <param name="start"></param>
 /// <param name="goal"></param>
 /// <param name="unitMovementType"></param>
 /// <returns></returns>
 public List <Coordinate3D> GetShortestPath(Coordinate3D start, Coordinate3D goal, MovementType unitMovementType)
 {
     return(AStarSearch.FindShortestPath(this, start, goal, unitMovementType));
 }
Пример #3
0
 /// <summary>
 ///     Returns true if graph contains the coordinate, false otherwise
 /// </summary>
 /// <param name="coordinate"></param>
 /// <returns></returns>
 public bool Contains(Coordinate3D coordinate)
 {
     return(Cells.ContainsKey(coordinate));
 }
Пример #4
0
 /// <summary>
 ///     Returns true if the cell is marked as not passable, false otherwise
 /// </summary>
 /// <param name="coordinate"></param>
 /// <returns></returns>
 public bool IsCellBlocked(Coordinate3D coordinate)
 {
     return(Cells[coordinate].IsBlocked);
 }
Пример #5
0
 public void UnblockCells(Coordinate3D coordinate)
 {
     SetCellBlockStatus(coordinate, false);
 }
Пример #6
0
        public void SetCellsTerrainType(Coordinate3D coordinate, TerrainType terrainType)
        {
            var cellState = GetCellState(coordinate);

            cellState.TerrainType = terrainType;
        }
Пример #7
0
 public void BlockCells(Coordinate3D coordinate)
 {
     SetCellBlockStatus(coordinate, true);
 }
Пример #8
0
 public void RemoveCell(Coordinate3D coordinate3D)
 {
     CellsList.Remove(Cells[coordinate3D]);
     Cells.Remove(coordinate3D);
 }
Пример #9
0
 private bool IsPassable(Coordinate3D coordinate3D)
 {
     return(Contains(coordinate3D) && !IsCellBlocked(coordinate3D));
 }
Пример #10
0
        private void SetCellBlockStatus(Coordinate3D coordinate, bool isBlocked)
        {
            var cellState = GetCellState(coordinate);

            cellState.IsBlocked = isBlocked;
        }
Пример #11
0
 public static string ToString(List <Coordinate3D> coordinate3Ds)
 {
     return(ToString(Coordinate3D.To2D(coordinate3Ds, OffsetTypes.OddRowsRight)));
 }