Exemplo n.º 1
0
        private void StartAnimation(CharacterAnimationInfo animationInfo, Action onComplete = null, Action onCancel = null, bool restart = true, bool async = false)
        {
            //IL_0030: Unknown result type (might be due to invalid IL or missing references)
            //IL_0046: Unknown result type (might be due to invalid IL or missing references)
            string animationName = animationInfo.animationName;
            string timelineKey   = animationInfo.timelineKey;

            m_animator2D.get_transform().set_localRotation(animationInfo.flipX ? Quaternion.Euler(0f, -135f, 0f) : Quaternion.Euler(0f, 45f, 0f));
            direction = animationInfo.direction;
            ITimelineAssetProvider characterData = m_characterData;

            if (characterData != null)
            {
                TimelineAsset timelineAsset;
                bool          flag = characterData.TryGetTimelineAsset(timelineKey, out timelineAsset);
                if (flag && null != timelineAsset)
                {
                    if (timelineAsset != m_playableDirector.get_playableAsset())
                    {
                        m_playableDirector.Play(timelineAsset);
                    }
                    else
                    {
                        if (restart || !m_animator2D.get_animationName().Equals(animationName))
                        {
                            m_playableDirector.set_time(0.0);
                        }
                        m_playableDirector.Resume();
                    }
                    m_hasTimeline = true;
                }
                else
                {
                    if (flag)
                    {
                        Log.Warning("Character named '" + m_characterData.get_name() + "' has a timeline setup for key '" + timelineKey + "' but the actual asset is null.", 323, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\HavreMap\\MapPathfindingActor.cs");
                    }
                    m_playableDirector.set_time(0.0);
                    m_playableDirector.Pause();
                    m_hasTimeline = false;
                }
            }
            m_animationCallback.Setup(animationName, restart, onComplete, onCancel);
            m_animator2D.SetAnimation(animationName, animationInfo.loops, async, restart);
            m_animationParameters = animationInfo.parameters;
        }
Exemplo n.º 2
0
        private void PlayTimeline(string timelineKey, string animationName, bool restart)
        {
            ITimelineAssetProvider characterData = m_characterData;

            if (characterData == null)
            {
                return;
            }
            TimelineAsset timelineAsset;
            bool          flag = characterData.TryGetTimelineAsset(timelineKey, out timelineAsset);

            if (flag && null != timelineAsset)
            {
                if (timelineAsset != m_playableDirector.get_playableAsset())
                {
                    m_playableDirector.Play(timelineAsset);
                }
                else
                {
                    if (restart || !m_animator.animationName.Equals(animationName))
                    {
                        m_playableDirector.set_time(0.0);
                    }
                    m_playableDirector.Resume();
                }
                m_hasTimeline = true;
            }
            else
            {
                if (flag)
                {
                    Log.Warning("Character named '" + GetAnimatedCharacterData().get_name() + "' has a timeline setup for key '" + timelineKey + "' but the actual asset is null.", 121, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\FloorMechanismObject.cs");
                }
                m_playableDirector.set_time(0.0);
                m_playableDirector.Pause();
                m_hasTimeline = false;
            }
        }