少年修仙传客户端代码仓库
client_Wu Xijin
2019-03-14 49287ea39a0ad3dde2b9a957d9f516f4b96d098a
System/Realm/RealmAnimationBehaviour.cs
@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
@@ -14,6 +15,8 @@
        Coroutine m_RotateCoroutine = null;
        float m_DeltaAngle { get { return 360f / 8; } }
        public event Action onRotateComplete;
        public void SetDefault()
        {
@@ -43,7 +46,7 @@
            return new Vector3(_x, _y, _z);
        }
        void StartRotate()
        public void StartRotate()
        {
            if (m_RotateCoroutine != null)
            {
@@ -52,10 +55,21 @@
            m_RotateCoroutine = StartCoroutine(Co_Rotate());
        }
        public void StopRotate()
        {
            if (m_RotateCoroutine != null)
            {
                StopCoroutine(m_RotateCoroutine);
            }
        }
        IEnumerator Co_Rotate()
        {
            var timer = 0f;
            m_ContainerLine.gameObject.SetActive(true);
            bool rotate30 = false;
            while (timer < m_Duration)
            {
                timer += Time.deltaTime;
@@ -63,6 +77,23 @@
                var t = Mathf.Clamp01(timer / m_Duration);
                var value = m_TweenCurve.Evaluate(t);
                var angle = Mathf.LerpUnclamped(0, 180, value);
                if (angle >= 30 && !rotate30)
                {
                    foreach (var realmStage in m_RealmStages)
                    {
                        if (realmStage.animIndex == 0)
                        {
                            realmStage.gameObject.SetActive(false);
                        }
                        else
                        {
                            realmStage.gameObject.SetActive(true);
                        }
                    }
                    rotate30 = true;
                }
                for (int i = 0; i < m_RealmStages.Length; i++)
                {
                    var cacheAngle = GetPointAngle(m_RealmStages[i].animIndex);
@@ -73,7 +104,12 @@
            m_ContainerLine.gameObject.SetActive(false);
            foreach (var realmStage in m_RealmStages)
            {
                realmStage.animIndex = (realmStage.animIndex + 4) % 8;
                realmStage.animIndex = (realmStage.animIndex + 5) % 9;
            }
            if (onRotateComplete != null)
            {
                onRotateComplete();
            }
        }