public TutorialUIProp SpawnProp(List <TutorialUIProp> _propList, TutorialUIProp _propPrefab, Transform _parent, Vector3 _position, bool _overlayed) { TutorialUIProp prop = null; foreach (TutorialUIProp p in _propList) { if (p.gameObject.activeSelf) { continue; } prop = p; break; } if (prop == null) { prop = Instantiate(_propPrefab, _position, Quaternion.identity, _parent) as TutorialUIProp; _propList.Add(prop); } prop.Show(_parent, _position, _overlayed); return(prop); }
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)); }