public void UpdateBackground(PTFlatGroups groups) { if (content.Count < 1) { if (myBackground) { UnityEngine.Object.Destroy(myBackground.gameObject); } return; } if (isGroup) { if (!myBackground) { //instantiate a background instance myBackground = UnityEngine.Object.Instantiate(groups.backgroundPrefab, groups.transform); myBackground.transform.position = content[0].transform.position + groups.positionBackgroudSpawn; } myBackground.UpdateBackground(new KeyValuePair <int, PTFlatGroupCollection>(groups.IndexOf(this), this)); } else { if (myBackground) { UnityEngine.Object.Destroy(myBackground.gameObject); } } }
private void Awake() { groups = GetComponentInParent <PTFlatGroups>(); PTGlobalInput.OnDragBegin += (PTTouch touch) => { if (IsDraggingTab(touch)) { touch.AddFollower(GetComponent <Collider>(), GetComponent <PTLocalInput>().dragWorldPositionOffset); foreach (PTFlatGroupElement element in Collection.Value.content) { touch.AddFollower(element.GetComponent <Collider>(), GetComponent <PTLocalInput>().dragWorldPositionOffset); } } }; PTGlobalInput.OnDrag += (PTTouch touch) => { if (IsDraggingTab(touch)) { groups.SwapCollections(Collection.Key, CollectionExpectedToSwap.Key); } }; }
private void Awake() { groups = GetComponentInParent <PTFlatGroups>(); }