// Use this for initialization void Start() { // Set initial values _fingerId = -1; _speed = 10f; _drag = true; _animateLerpUp = false; _animateLerpDown = false; _maxDragDistance = Screen.height * 0.14f; // Get required components _model = GetComponent<EntryBoxModel> (); _handler = GetComponent<EntryBoxHandler> (); _wordBuilder = GameObject.Find ("Builder").GetComponent<WordBuilder>(); // Hook event handlers ConnectEvents (); }
private void OnEntryBoxDeleted(EntryBoxModel boxModel) { if (!boxModel.Occupied) { switch (boxModel.Index) { case 0: _model.Letter1.Visible = true; _model.Letter1 = null; break; case 1: _model.Letter2.Visible = true; _model.Letter2 = null; break; case 2: _model.Letter3.Visible = true; _model.Letter3 = null; break; case 3: _model.Letter4.Visible = true; _model.Letter4 = null; break; default: break; } AddIndex (boxModel.Index); } }
private void OnEntryBoxOccupyChanged(EntryBoxModel model) { if (model.Occupied) { GameObject letter = _wordBuilder.BuildLetter (model.KeyModel); letter.transform.SetParent (transform); RectTransform keyRect = letter.GetComponent<RectTransform> (); keyRect.offsetMin = new Vector2 (0, 0); keyRect.offsetMax = new Vector2 (0, 0); keyRect.localScale = new Vector3 (1, 1, 1); _initPosition = (Vector3) letter.transform.position; } else { if(transform.childCount > 0) { _wordBuilder.DestroyLetter(transform.GetChild(0).gameObject); } } }
// Use this for initialization void Start() { // Get required components _model = GetComponent<EntryBoxModel> (); }