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;
     }
 }
Пример #2
0
        public CharacterAnimationInfo(Vector2 position, string animationName, string timelineKey, bool loops, Direction direction, DirectionAngle mapRotation)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_0002: Unknown result type (might be due to invalid IL or missing references)
            this.position  = position;
            this.direction = direction;
            switch (direction.Rotate(mapRotation))
            {
            case Direction.None:
                this.animationName = animationName;
                flipX = false;
                break;

            case Direction.East:
                this.animationName = animationName + "4";
                flipX = true;
                break;

            case Direction.SouthEast:
                this.animationName = animationName + "1";
                flipX = false;
                break;

            case Direction.South:
                this.animationName = animationName + "2";
                flipX = false;
                break;

            case Direction.SouthWest:
                this.animationName = animationName + "1";
                flipX = true;
                break;

            case Direction.West:
                this.animationName = animationName + "4";
                flipX = false;
                break;

            case Direction.NorthWest:
                this.animationName = animationName + "5";
                flipX = false;
                break;

            case Direction.North:
                this.animationName = animationName + "6";
                flipX = false;
                break;

            case Direction.NorthEast:
                this.animationName = animationName + "5";
                flipX = true;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            this.timelineKey = timelineKey;
            this.loops       = loops;
            parameters       = new CharacterAnimationParameters(animationName, timelineKey, loops, direction, Direction.None);
        }
        protected void StartFightAnimation(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 animatedCharacterData = GetAnimatedCharacterData();

            if (animatedCharacterData != null)
            {
                TimelineAsset timelineAsset;
                bool          flag = animatedCharacterData.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 '" + GetAnimatedCharacterData().get_name() + "' has a timeline setup for key '" + timelineKey + "' but the actual asset is null.", 171, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\BoardCharacterObject.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;
            }
        }
Пример #5
0
        public CharacterAnimationInfo(Vector2 position, string animationName, string timelineKey, bool loops, Direction previousDirection, Direction direction, DirectionAngle mapRotation)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_0002: Unknown result type (might be due to invalid IL or missing references)
            this.position  = position;
            this.direction = direction;
            Direction direction2 = previousDirection.Rotate(mapRotation);
            Direction direction3 = direction.Rotate(mapRotation);

            switch (direction2)
            {
            case Direction.SouthEast:
                switch (direction3)
                {
                case Direction.SouthWest:
                    this.animationName = animationName + "31";
                    break;

                case Direction.NorthEast:
                    this.animationName = animationName + "35";
                    break;

                case Direction.NorthWest:
                    this.animationName = animationName + "35";
                    break;

                default:
                    throw new ArgumentOutOfRangeException("direction", $"Incompatible change of direction: {previousDirection} to {direction}.");
                }
                flipX = true;
                break;

            case Direction.SouthWest:
                switch (direction3)
                {
                case Direction.SouthEast:
                    this.animationName = animationName + "31";
                    break;

                case Direction.NorthWest:
                    this.animationName = animationName + "35";
                    break;

                case Direction.NorthEast:
                    this.animationName = animationName + "35";
                    break;

                default:
                    throw new ArgumentOutOfRangeException("direction", $"Incompatible change of direction: {previousDirection} to {direction}.");
                }
                flipX = false;
                break;

            case Direction.NorthWest:
                switch (direction3)
                {
                case Direction.SouthWest:
                    this.animationName = animationName + "71";
                    break;

                case Direction.NorthEast:
                    this.animationName = animationName + "75";
                    break;

                case Direction.SouthEast:
                    this.animationName = animationName + "71";
                    break;

                default:
                    throw new ArgumentOutOfRangeException("direction", $"Incompatible change of direction: {previousDirection} to {direction}.");
                }
                flipX = true;
                break;

            case Direction.NorthEast:
                switch (direction3)
                {
                case Direction.SouthEast:
                    this.animationName = animationName + "71";
                    break;

                case Direction.NorthWest:
                    this.animationName = animationName + "75";
                    break;

                case Direction.SouthWest:
                    this.animationName = animationName + "71";
                    break;

                default:
                    throw new ArgumentOutOfRangeException("direction", $"Incompatible change of direction: {previousDirection} to {direction}.");
                }
                flipX = false;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            this.timelineKey = timelineKey;
            this.loops       = loops;
            parameters       = new CharacterAnimationParameters(animationName, timelineKey, loops, previousDirection, direction);
        }