Пример #1
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            if (actor == ColliderActor.MainCharacter && !other.CompareTag("MainCharacter"))
            {
                return;
            }

            if (actor == ColliderActor.Box && !other.CompareTag("Box"))
            {
                return;
            }

            if (times == Times.Once && _timesCalled > 0)
            {
                return;
            }

            if (_conditions != null && !_conditions.AreCleared())
            {
                return;
            }

            _timesCalled++;
            onCollide.Invoke();

            if (_actions != null)
            {
                _actions.Invoke();
            }
        }
Пример #2
0
        private void UpdateMessageText()
        {
            if (_conditions.AreCleared())
            {
                return;
            }

            string message = _conditions.GetMessage();

            if (messageText.text == message)
            {
                return;
            }

            Vector2 values   = messageText.GetPreferredValues(message);
            float   newWidth = values.x + 0.4f;

            Rect rect = _messagePopupTransform.rect;

            _messagePopupTransform.sizeDelta = new Vector2(newWidth, rect.height);
            messageText.SetText(message);
        }