public override void ChangeDirection(Direction newDirection)
 {
     //IL_0010: Unknown result type (might be due to invalid IL or missing references)
     //IL_0015: Unknown result type (might be due to invalid IL or missing references)
     //IL_001a: Unknown result type (might be due to invalid IL or missing references)
     //IL_0038: Unknown result type (might be due to invalid IL or missing references)
     //IL_0078: Unknown result type (might be due to invalid IL or missing references)
     //IL_00b6: Unknown result type (might be due to invalid IL or missing references)
     //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
     if (newDirection != m_direction)
     {
         Vector2    position   = Vector2Int.op_Implicit(m_cellObject.coords);
         Animator2D animator2D = m_animator2D;
         CharacterAnimationParameters animationParameters    = m_animationParameters;
         CharacterAnimationInfo       characterAnimationInfo = (m_animationParameters.secondDirection == Direction.None) ? new CharacterAnimationInfo(position, animationParameters.animationName, animationParameters.timelineKey, animationParameters.loops, newDirection, m_mapRotation) : new CharacterAnimationInfo(previousDirection: DirectionExtensions.Rotate(angle: m_direction.DirectionAngleTo(newDirection), value: animationParameters.firstDirection), position: position, animationName: animationParameters.animationName, timelineKey: animationParameters.timelineKey, loops: animationParameters.loops, direction: newDirection, mapRotation: m_mapRotation);
         animator2D.get_transform().set_localRotation(characterAnimationInfo.flipX ? Quaternion.Euler(0f, -135f, 0f) : Quaternion.Euler(0f, 45f, 0f));
         direction = newDirection;
         string animationName = characterAnimationInfo.animationName;
         int    currentFrame  = animator2D.get_currentFrame();
         m_animationCallback.ChangeAnimationName(animationName);
         animator2D.SetAnimation(animationName, characterAnimationInfo.loops, false, true);
         animator2D.set_currentFrame(currentFrame);
         m_animationParameters = characterAnimationInfo.parameters;
     }
 }
Example #2
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;
        }
        protected override void OnMapRotationChanged(DirectionAngle previousMapRotation, DirectionAngle newMapRotation)
        {
            //IL_0010: Unknown result type (might be due to invalid IL or missing references)
            //IL_0016: Invalid comparison between Unknown and I4
            //IL_0021: Unknown result type (might be due to invalid IL or missing references)
            //IL_0026: Unknown result type (might be due to invalid IL or missing references)
            //IL_002b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            //IL_007e: Unknown result type (might be due to invalid IL or missing references)
            //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
            base.OnMapRotationChanged(previousMapRotation, newMapRotation);
            Animator2D animator2D = m_animator2D;

            if ((int)animator2D.GetInitialisationState() == 3)
            {
                Vector2 position = Vector2Int.op_Implicit(m_cellObject.coords);
                CharacterAnimationParameters animationParameters = m_animationParameters;
                CharacterAnimationInfo       characterAnimationInfo;
                if (m_animationParameters.secondDirection == Direction.None)
                {
                    characterAnimationInfo = new CharacterAnimationInfo(position, animationParameters.animationName, animationParameters.timelineKey, animationParameters.loops, direction, newMapRotation);
                }
                else
                {
                    DirectionAngle angle             = newMapRotation.Substract(previousMapRotation);
                    Direction      previousDirection = animationParameters.firstDirection.Rotate(angle);
                    characterAnimationInfo = new CharacterAnimationInfo(position, animationParameters.animationName, animationParameters.timelineKey, animationParameters.loops, previousDirection, direction, newMapRotation);
                }
                animator2D.get_transform().set_localRotation(characterAnimationInfo.flipX ? Quaternion.Euler(0f, -135f, 0f) : Quaternion.Euler(0f, 45f, 0f));
                string animationName = characterAnimationInfo.animationName;
                int    currentFrame  = animator2D.get_currentFrame();
                m_animationCallback.ChangeAnimationName(animationName);
                animator2D.SetAnimation(animationName, characterAnimationInfo.loops, false, true);
                animator2D.set_currentFrame(currentFrame);
                m_animationParameters = characterAnimationInfo.parameters;
            }
        }