void TryRegister(FieldCellModel mc) { if (!_currentWordFieldCells.Contains(mc)) { var lastFc = _currentWordFieldCells.LastOrDefault(); if (lastFc == null) { AddToCurrentWordNewFieldCell(mc); } else { var i = lastFc.I; var j = lastFc.J; var difI = i - mc.I; var difJ = j - mc.J; if (-1 <= difI && difI <= 1 && -1 <= difJ && difJ <= 1) { AddToCurrentWordNewFieldCell(mc); } } } }
public void InitializeWithModel(FieldCellModel model) { this._model = model; _cellText.text = _model.Char.ToString().ToUpper(); _cellBackgroundImage.color = GetColorByPrice(_model.Price); }
public FieldCellModel[,] GenerateField(int rows, int columns) { var allCells = new FieldCellModel[rows, columns]; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { allCells[i, j] = new FieldCellModel( character: _charPosibilityCalculator.GenerateRandomChar(), price: _priceCalculator.CalculatePrice(), i: i, j: j); } } return(allCells); }
void MouseLeft(FieldCellModel mc) { OnMouseLeft(mc); }
void MouseEnter(FieldCellModel mc) { OnMouseEntered(mc); }
void AddToCurrentWordNewFieldCell(FieldCellModel mc) { _currentWordFieldCells.Add(mc); CurrentWord = new string(_currentWordFieldCells.Select(x => x.Char).ToArray()); }