public void Initialize(int wordLength) { this.wordLength = wordLength; lettersOfWordInHistory = wordHistoryGrid.gameObject.GetComponent<LetterGridController> (); wordHistoryGrid.GetComponent<UIGrid> ().maxPerLine = wordLength; letterImageTable = GameObject.Find ("DataTables").GetComponent<LetterImageTable> (); InteractiveLetter.LetterPressed += PlayWordOfPressedLetter; }
void InitializeFieldsIfNecessary() { if (letterGrid == null) letterGrid = gameObject; if (letterImageTable == null) letterImageTable = GameObject.Find ("DataTables").GetComponent<LetterImageTable> (); if (blankLetter == null) blankLetter = letterImageTable.getBlankLetterImage (); if (letterImageWidth == 0 || letterImageHeight == 0) //you can specify dimensions for the image that are different from those of the grid. MatchLetterImageToGridCellDimensions (); //but if nothing is specified it defaults to make it the same size as the grid cells. if (letterHighlightsGrid) { UIGrid high = letterHighlightsGrid.GetComponent<UIGrid> (); UIGrid letters = letterGrid.GetComponent<UIGrid> (); high.cellWidth = letters.cellWidth; high.cellHeight = letters.cellHeight; letterHighlightsGrid.transform.position = letterGrid.transform.position; selectH = letterImageHeight; selectW = letterImageWidth; } if (letterHighlightsGrid) { UIGrid high = letterHighlightsGrid.GetComponent<UIGrid> (); UIGrid letters = letterGrid.GetComponent<UIGrid> (); high.cellWidth = letters.cellWidth; high.cellHeight = letters.cellHeight; letterHighlightsGrid.transform.position = letterGrid.transform.position; } }
void Awake() { instance = this; }