Пример #1
0
        public TutorialUILineGroup SpawnLineGroup(Transform _parent, Vector3 _position, bool _overlayed)
        {
            TutorialUILineGroup lineG = null;

            foreach (TutorialUILineGroup lr in linesPool)
            {
                if (lr.gameObject.activeSelf)
                {
                    continue;
                }
                lineG = lr;
                break;
            }
            if (lineG == null)
            {
                lineG = Instantiate(LineGroupPrefab, _parent) as TutorialUILineGroup;
                linesPool.Add(lineG);
            }
            lineG.Spawn(_position, _overlayed);
            return(lineG);
        }
Пример #2
0
        TutorialUIAnimation DoDrawLine(Vector3[] _path, PathType _pathType, DrawLineMode _mode, bool _persistent, bool _overlayed)
        {
            bool           hasFinger = _mode == DrawLineMode.Finger || _mode == DrawLineMode.FingerAndArrow;
            bool           hasArrow  = _mode == DrawLineMode.Arrow || _mode == DrawLineMode.FingerAndArrow;
            TutorialUIProp arrow     = null;
            Vector3        startPos  = _path[0];

            TutorialUILineGroup  lr = null;
            TutorialUITrailGroup tr = null;

            if (_persistent)
            {
                lr = Pools.SpawnLineGroup(this.transform, startPos, _overlayed);
                currMovingTarget = lr.transform;
            }
            else
            {
                tr = Pools.SpawnTrailGroup(this.transform, startPos, _overlayed);
                currMovingTarget = tr.transform;
            }

            if (hasFinger)
            {
                Finger.Show(currMovingTarget, startPos);
            }
            if (hasArrow)
            {
                arrow = Pools.SpawnArrow(this.transform, startPos, _overlayed);
            }

            float       actualDrawSpeed = DrawSpeed * GetCameraBasedScaleMultiplier(_path[0]);
            TweenParams parms           = TweenParams.Params.SetSpeedBased().SetEase(Ease.OutSine).SetId(TweenId);

            Tween mainTween = currMovingTarget.DOPath(_path, actualDrawSpeed, _pathType).SetAs(parms);

            if (_persistent)
            {
                mainTween.OnUpdate(() => lr.AddPosition(lr.transform.position));
                mainTween.OnStepComplete(() => {
                    if (hasFinger && lr.transform == currMovingTarget)
                    {
                        Finger.Hide();
                    }
                });
            }
            else
            {
                mainTween.OnStepComplete(() => {
                    if (hasFinger && tr.transform == currMovingTarget)
                    {
                        Finger.Hide();
                    }
                });
            }

            if (hasArrow)
            {
                Tween t = arrow.transform.DOPath(_path, actualDrawSpeed, _pathType).SetLookAt(0.01f).SetAs(parms);
                if (!_persistent)
                {
                    t.OnComplete(() => { DOVirtual.DelayedCall(Mathf.Max(tr.Time - 0.2f, 0), () => arrow.Hide(), false).SetId(TweenId); });
                }
            }

            return(new TutorialUIAnimation(mainTween));
        }