예제 #1
0
        public static void WorldSpawn(string text, Vector3 start, Color color)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            _msgChecker.Add(text, UIRoot.Misc.Get().transform);
            UIFloatingText spawn = ItemPool.SpawnUIPrefab <UIFloatingText>("UI/UIFloatingTextStandard", UIRoot.Misc.Get().transform);

            spawn.transform.position = RectTransformUtility.WorldToScreenPoint(Player.Cam, start);
            var end = RectTransformUtility.WorldToScreenPoint(Player.Cam, start + new Vector3(0, 1, 0));

            spawn.RectTransform.SetAsLastSibling();
            TimeManager.StartUnscaled(spawn.SetTargetText(text, 2f, end, color));
        }
예제 #2
0
        public static void SpawnIcon(Sprite icon, string text, RectTransform start, Color color)
        {
            var            startPosition = start.position;
            UIFloatingText spawn         = ItemPool.SpawnUIPrefab <UIFloatingText>("UI/UIFloatingTextIcon", start);

            spawn.RectTransform.SetParent(UIRoot.Misc.Get().transform);
            spawn.RectTransform.SetAsLastSibling();
            if (_iconTimer.IsActive)
            {
                startPosition = start.position + new Vector3(_negative ? -Offset : Offset, 0, 0);
                spawn.RectTransform.position = startPosition;
                _negative = !_negative;
            }
            _iconTimer.StartTimer();
            spawn._icon.sprite = icon;
            TimeManager.StartUnscaled(spawn.SetTargetText(text, 2f, startPosition + new Vector3(0, 150, 0), color));
        }