void ProcessCellConditionals(GridCell cell) { if (cell.cellTemplate.stairMode != CellTemplate.StairMode.None) { //Stair position relative to its entrance //0 Up, 1 Right, 2 Down, 3 Left int dir = cell.cellTemplate.GetCellStairDirection(cell); IntVector2 orientation = dir % 2 == 0 ? new IntVector2(0, dir - 1) : new IntVector2((dir - 2), 0); if (orientation.Add(cell.gridIndex).IsValid(this)) { cell.stairExits.Item1 = new IntVector2(orientation.x + cell.gridIndex.x, orientation.y + cell.gridIndex.y); GetCellByIndex(orientation.Add(cell.gridIndex)).HasAdjacentStair = true; } orientation = new IntVector2(orientation.x * -1, orientation.y * -1); if (orientation.Add(cell.gridIndex).IsValid(this)) { cell.stairExits.Item2 = new IntVector2(orientation.x + cell.gridIndex.x, orientation.y + cell.gridIndex.y); GetCellByIndex(orientation.Add(cell.gridIndex)).HasAdjacentStair = true; } } }
public static IntVector2 Add(IntVector2 a, IntVector2 b) { return(a.Add(b)); }