コード例 #1
0
    IEnumerator OnDroppedCoroutine()
    {
        yield return(new WaitForEndOfFrame());

        yield return(new WaitUntil(() => !GameManager.GameIsPaused));

        if (DroppedInSlot) // Set from within the Slot reacting to its own OnDropEvent
        {
            ToggleHintEvent?.Invoke(_localizedHintText, true);
            PuzzlePieceSlottedEvent?.Invoke(gameObject);
            gameObject.SetActive(false);
        }
        else  // If the puzzle piece was not dropped on the correct slot reset it
        {
            _canvasGroup.alpha              = 1f;
            _canvasGroup.blocksRaycasts     = true;
            _rectTransform.anchoredPosition = _defaultPos;
            // Dragging sometimes does funny things by setting z level at -400. This hopefully fixes that
            if (_rectTransform.localPosition.z != 0f)
            {
                _rectTransform.localPosition = new Vector3(_rectTransform.localPosition.x, _rectTransform.localPosition.y, 0f);
            }
        }
    }
コード例 #2
0
 public void OnPointerClick(PointerEventData eventData)
 {
     ToggleHintEvent?.Invoke(_localizedHintText, false);
 }