//Finds all the necessary objects on field public override void OnStartClient() { var prefab = Resources.Load("LetterLAN", typeof(GameObject)) as GameObject; LetterPrefab = prefab.GetComponent <LetterLAN>(); NumberOfLettersText = GameObject.FindGameObjectWithTag("NumberOfLetters").GetComponent <Text>(); CurrentLetters = new List <LetterLAN>(); transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform); gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0, 0); gameObject.transform.localPosition = new Vector3(0, 0); FreeCoordinates = new List <Vector3>(); _currentField = GameObject.FindGameObjectWithTag("Field").GetComponent <FieldLAN>(); _distanceBetweenLetters = _currentField.DistanceBetweenTiles; _letterSize = new Vector2(_distanceBetweenLetters, _distanceBetweenLetters); LetterPrefab.gameObject.GetComponent <RectTransform>().sizeDelta = _letterSize; _xOffset = gameObject.transform.position.x - 2 * _distanceBetweenLetters; var yOffset = gameObject.transform.position.y + _distanceBetweenLetters; _pos = new Vector3(_xOffset, yOffset); _allLetters = new List <string> { "а", "а", "с", "и", "р", "о", "р", "д", "ш", "и", "и", "и", "ц", "е", "н", "а", "т", "щ", "л", "к", "ж", "п", "в", "к", "о", "в", "а", "у", "н", "к", "е", "м", "г", "і", "н", "х", "і", "н", "и", "н", "а", "и", "р", "л", "р", "с", "п", "м", "а", "у", "а", "ю", "м", "с", "б", "в", "я", "м", "т", "ф", "с", "и", "о", "я", "п", "о", "о", "л", "е", "а", "б", "і", "е", "ь", "т", "р", "ґ", "з", "д", "о", "і", "і", "є", "й", "е", "д", "н", "о", "у", "г", "ї", "ч", "о", "о", "о", "к", "т", "н", "в", "т", "з", "'", "*", "*" }; _allLetters = _allLetters.OrderBy(letter => letter).ToList(); AllLetters.AddRange(_allLetters); if (_currentField.PlayerToSendCommands == null) { _currentField.PlayerToSendCommands = this; } if (isServer) { _waitTextGameObject = GameObject.FindWithTag("Wait"); _currentField.PlayerNumber = 1; _waitTextGameObject.GetComponent <Text>().enabled = true; } else { _currentField.PlayerNumber = 2; } }
private void Start() { parent = transform.parent.gameObject.GetComponent <FieldLAN>(); }