private void LoadSlotTypes() { TextAsset boardLayoutTextAsset = Resources.Load <TextAsset>("BoardLayout"); string[] lines = boardLayoutTextAsset.text.Split(new string[] { "\n" }, System.StringSplitOptions.RemoveEmptyEntries); for (int y = 0; y < lines.Length; y++) { string currentLine = lines[y]; string[] types = currentLine.Split(new string[] { "," }, System.StringSplitOptions.RemoveEmptyEntries); for (int x = 0; x < types.Length; x++) { string currentType = types[x]; BoardSlotData currentSlot = _slotsMatrix[x][y]; if (currentType == " ") { currentSlot.Type = BoardSlotData.SlotType.Empty; } else if (currentType == "**") { currentSlot.Type = BoardSlotData.SlotType.Center; } else { currentSlot.Type = (BoardSlotData.SlotType)Enum.Parse(typeof(BoardSlotData.SlotType), currentType); } } } }
private List <BoardSlotData> CreateSlotsCollum() { List <BoardSlotData> slotsCollum = new List <BoardSlotData>(); for (int x = 0; x < _size; x++) { BoardSlotData slot = new BoardSlotData(); slotsCollum.Add(slot); _horizontalLines[x].Slots.Add(slot); } return(slotsCollum); }
public string GetString() { string stringVar = string.Empty; for (int x = 0; x < _slots.Count; x++) { BoardSlotData currentSlot = _slots[x]; if (currentSlot.Chip != null) { stringVar += currentSlot.Chip.Letter; } } return(stringVar); }
private void CreateSlotsMatrix() { _slotsMatrix.Clear(); _verticalLines.Clear(); _horizontalLines.Clear(); for (int x = 0; x < _size; x++) { _horizontalLines.Add(new BoardLine()); } for (int x = 0; x < _size; x++) { List <BoardSlotData> collum = CreateSlotsCollum(); _slotsMatrix.Add(collum); _verticalLines.Add(new BoardLine(collum)); } int centerIndex = _size / 2; _centerSlot = _slotsMatrix[centerIndex][centerIndex]; }