| | |
| | | [SerializeField] float m_Radius = 100f;
|
| | | [SerializeField] float m_Duration = 1f;
|
| | | [SerializeField] TweenCurve m_TweenCurve;
|
| | | [SerializeField] Transform m_RealmStageCenter;
|
| | | [SerializeField] Transform m_ContainerLine;
|
| | | [SerializeField] RealmStageBehaviour[] m_RealmStages;
|
| | | [SerializeField] Transform m_ContainerEffectLine;
|
| | | [SerializeField] UIEffect[] m_EffectLines;
|
| | |
|
| | | Coroutine m_RotateCoroutine = null;
|
| | |
|
| | | float m_DeltaAngle { get { return 360f / 8; } }
|
| | |
|
| | | public event Action onRotateComplete;
|
| | |
|
| | | RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } }
|
| | |
|
| | | public void SetDefault()
|
| | | {
|
| | |
| | | {
|
| | | m_RealmStages[i].transform.localPosition = GetPointPosition(i);
|
| | | m_RealmStages[i].animIndex = i;
|
| | | }
|
| | | m_ContainerEffectLine.localEulerAngles = Vector3.zero;
|
| | | DisplayEffectLines();
|
| | | }
|
| | |
|
| | | void DisplayEffectLines()
|
| | | {
|
| | | var realmLevel = PlayerDatas.Instance.baseData.realmLevel;
|
| | | var stage = model.GetRealmStage(realmLevel);
|
| | | List<int> realms = null;
|
| | | if (model.TryGetRealmStages(stage, out realms))
|
| | | {
|
| | | for (int i = 0; i < realms.Count; i++)
|
| | | {
|
| | | var level = realms[i] + 1;
|
| | | if (realmLevel >= level)
|
| | | {
|
| | | // m_EffectLines[i].Play();
|
| | | // var animator = m_EffectLines[i].target.GetAnimator();
|
| | | // animator.Play("idle", 0);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | Vector3 GetPointPosition(float angle)
|
| | | {
|
| | | var _x = transform.position.x + m_Radius * Mathf.Sin(Mathf.Deg2Rad * angle);
|
| | | var _y = transform.position.y + m_Radius * Mathf.Cos(Mathf.Deg2Rad * angle);
|
| | | var _z = transform.position.z;
|
| | | var _x = m_RealmStageCenter.position.x + m_Radius * Mathf.Sin(Mathf.Deg2Rad * angle);
|
| | | var _y = m_RealmStageCenter.position.y + m_Radius * Mathf.Cos(Mathf.Deg2Rad * angle);
|
| | | var _z = m_RealmStageCenter.position.z;
|
| | | return new Vector3(_x, _y, _z);
|
| | | }
|
| | |
|
| | | public void StartRotate()
|
| | | public void DisplayLevelUp(int index)
|
| | | {
|
| | | StartCoroutine(Co_DisplayLevelUp(index));
|
| | | }
|
| | |
|
| | | IEnumerator Co_DisplayLevelUp(int index)
|
| | | {
|
| | | if (index >= m_EffectLines.Length)
|
| | | {
|
| | | yield break;
|
| | | }
|
| | | //m_EffectLines[index].Play();
|
| | | //var animator = m_EffectLines[index].target.GetAnimator();
|
| | | //animator.Play("open", 0, 0);
|
| | | //yield return WaitingForSecondConst.WaitMS1500;
|
| | | //animator.Play("idle", 0);
|
| | | var realmStage = GetRealmStageBeha(index + 1);
|
| | | if (realmStage != null)
|
| | | {
|
| | | realmStage.DisplayEffect(true);
|
| | | }
|
| | | yield return WaitingForSecondConst.WaitMS500;
|
| | | if (index == 3)
|
| | | {
|
| | | StartRotate();
|
| | | }
|
| | | }
|
| | |
|
| | | RealmStageBehaviour GetRealmStageBeha(int index)
|
| | | {
|
| | | foreach (var realmStage in m_RealmStages)
|
| | | {
|
| | | if (realmStage.animIndex == index)
|
| | | {
|
| | | return realmStage;
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | void StartRotate()
|
| | | {
|
| | | if (m_RotateCoroutine != null)
|
| | | {
|
| | |
| | | m_RotateCoroutine = StartCoroutine(Co_Rotate());
|
| | | }
|
| | |
|
| | | public void StopRotate()
|
| | | public void Dispose()
|
| | | {
|
| | | StopAllCoroutines();
|
| | | if (m_RotateCoroutine != null)
|
| | | {
|
| | | StopCoroutine(m_RotateCoroutine);
|
| | | m_RotateCoroutine = null;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | realmStage.gameObject.SetActive(true);
|
| | | }
|
| | | }
|
| | | m_EffectLines[0].StopImediatly();
|
| | | rotate30 = true;
|
| | | }
|
| | |
|
| | |
| | | var position = GetPointPosition(cacheAngle - angle);
|
| | | m_RealmStages[i].transform.localPosition = position;
|
| | | }
|
| | |
|
| | | m_ContainerEffectLine.localEulerAngles = new Vector3(0, 0, angle);
|
| | | }
|
| | | m_ContainerLine.gameObject.SetActive(false);
|
| | | foreach (var realmStage in m_RealmStages)
|
| | | {
|
| | | realmStage.animIndex = (realmStage.animIndex + 5) % 9;
|
| | | }
|
| | |
|
| | | foreach (var effectLine in m_EffectLines)
|
| | | {
|
| | | effectLine.StopImediatly();
|
| | | }
|
| | | m_ContainerEffectLine.localEulerAngles = Vector3.zero;
|
| | |
|
| | | if (onRotateComplete != null)
|
| | | {
|
| | |
| | | void TestReset()
|
| | | {
|
| | | SetDefault();
|
| | | }
|
| | |
|
| | | [ContextMenu("Rotate")]
|
| | | void TestRotate()
|
| | | {
|
| | | StartRotate();
|
| | | }
|
| | | }
|
| | | } |