public void CloseBook() { blackBackground.DOFade(0, DURATION); blackBackground.blocksRaycasts = false; blackBackground.interactable = false; lastBookBox.GetComponent <RectTransform>().DORotate(lastRotation, DURATION); lastBookBox.GetComponent <RectTransform>().DOSizeDelta(lastSizeDelta, DURATION); lastBookBox.GetComponent <RectTransform>().DOAnchorPos(lastAnchoredPosition, DURATION); lastBookBox.CloseBook(); }
public void SelectBook(BookBox box) { lastBookBox = box; blackBackground.DOFade(1, DURATION); blackBackground.blocksRaycasts = true; blackBackground.interactable = true; var rect = box.GetComponent <RectTransform>(); lastRotation = rect.rotation.eulerAngles; rect.DORotate(Vector3.zero, DURATION); lastSizeDelta = rect.sizeDelta; rect.DOSizeDelta(Vector2.zero, DURATION); lastAnchoredPosition = rect.anchoredPosition; rect.DOAnchorPos(Vector2.zero + Vector2.up * 110, DURATION); blackBackground.transform.SetAsLastSibling(); rect.SetAsLastSibling(); }