/// <summary> /// Simple constructor /// </summary> /// <param name="c">Capacity of this field</param> public EvacuationElement(int c) { Processed = false; Capacity = c; Neighbours = new EvacuationElement[4]; NeighboursPassages = new IWallElement[4]; }
/// <summary> /// Set given wall element with gicen coordinates and orientation /// </summary> /// <param name="wep">Wall place position</param> /// <param name="element">Wall element</param> /// <returns>True if there was at least one floor tile, adjoning this coordinates, false otherwise</returns> private bool PlaceWallElement(WallElementPosition wep, IWallElement element) { TilePosition tp = wep.GetTilePosition(); Tile t = Get(tp.Row, tp.Col); if (t != null) { t.SetSide(wep.Orientation, element); return true; } return false; }
/// <summary> /// Set given wall element with gicen coordinates and orientation /// </summary> /// <param name="row">Row</param> /// <param name="col">Column</param> /// <param name="dir">Orienation</param> /// <param name="element">Wall element</param> /// <returns>True if there was at least one floor tile, adjoning this coordinates, false otherwise</returns> public bool SetWallElement(int row, int col, Direction dir, IWallElement element) { WallElementPosition wep = WallElementPosition.Create(this, row, col, dir); if (PlaceWallElement(wep, element) || PlaceWallElement(wep.GetAdjacentPosition(), element)) { element.Position = wep; if (element.Type == WallElementType.DOOR) Doors.Add((Door)element); return true; } return false; }
/// <summary> /// Set wall element in given direction /// </summary> /// <param name="dir">Direction</param> /// <param name="side">Wall element to set</param> public void SetSide(Direction dir, IWallElement side) { Side[(int)dir] = side; }
/// <summary> /// Initalize floor square with given capacity /// </summary> /// <param name="c">Capacity</param> public Tile(int c) { Capacity = c; Side = new IWallElement[4]; }