コード例 #1
0
 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
        protected override IEnumerator PlaySpawnAnimation()
        {
            CharacterAnimationInfo animationInfo = new CharacterAnimationInfo(Vector2Int.op_Implicit(m_cellObject.coords), "idle", "spawn", loops: false, direction, m_mapRotation);

            StartFightAnimation(animationInfo, (Action)((CharacterObject)this).PlayIdleAnimation, (Action)null, restart: true, async: false);
            yield break;
        }
コード例 #3
0
        public IEnumerator PlayRangedActionAnimation(Direction directionToAttack)
        {
            if (!m_characterData.hasRangedAttackAnimations)
            {
                yield return(PlayActionAnimation(directionToAttack, waitForAnimationEndOnMissingLabel: true));

                yield break;
            }
            CharacterAnimationInfo rangedAttackAnimationInfo = new CharacterAnimationInfo(Vector2Int.op_Implicit(m_cellObject.coords), "rangedattack", "rangedattack", loops: false, directionToAttack, m_mapRotation);

            StartFightAnimation(rangedAttackAnimationInfo, (Action)((CharacterObject)this).PlayIdleAnimation, (Action)null, restart: true, async: false);
            Animator2D animator = m_animator2D;
            int        num      = default(int);

            if (animator.CurrentAnimationHasLabel("shot", ref num))
            {
                while (!CharacterObjectUtility.HasAnimationReachedLabel(animator, rangedAttackAnimationInfo, "shot"))
                {
                    yield return(null);
                }
            }
            else
            {
                Log.Warning(animator.GetDefinition().get_name() + " is missing the 'shot' label in the animation named '" + rangedAttackAnimationInfo.animationName + "'.", 512, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\FightCharacterObject.cs");
            }
        }
コード例 #4
0
        protected IEnumerator MoveToDoActionRoutine(Vector2Int[] movementCells, Direction actionDirection)
        {
            int movementCellsCount = movementCells.Length;

            if (movementCellsCount != 0)
            {
                CellObject cellObject = m_cellObject;
                IMap       parentMap  = cellObject.parentMap;
                Vector2Int val        = movementCells[0];
                if (cellObject.coords != val)
                {
                    Log.Warning($"Was not on the start cell of a new movement sequence: {cellObject.coords} instead of {val} ({this.get_gameObject().get_name()}).", 341, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\FightCharacterObject.cs");
                    CellObject cellObject2 = parentMap.GetCellObject(val.get_x(), val.get_y());
                    SetCellObject(cellObject2);
                }
                Animator2D animator = m_animator2D;
                foreach (CharacterAnimationInfo item in CharacterFightMovementSequencer.ComputeMovementToAction(movementCells, actionDirection, m_mapRotation))
                {
                    CharacterAnimationInfo sequenceItem = item;
                    SetPosition(parentMap, sequenceItem.position);
                    StartFightAnimation(sequenceItem);
                    while (!CharacterObjectUtility.HasAnimationEnded(animator, sequenceItem))
                    {
                        yield return(null);
                    }
                }
                Vector2Int val2 = movementCells[movementCellsCount - 1];
                SetPosition(parentMap, Vector2Int.op_Implicit(val2));
                if (m_cellObject.TryGetIsoObject(out IObjectWithActivation _))
                {
                    direction = actionDirection;
                    PlayIdleAnimation();
                }
            }
        }
コード例 #5
0
 public static bool HasAnimationReachedLabel([NotNull] Animator2D animator2D, CharacterAnimationInfo animationInfo, [NotNull] string label)
 {
     if (!animator2D.get_reachedEndOfAnimation() && !label.Equals(animator2D.get_currentLabel(), StringComparison.OrdinalIgnoreCase))
     {
         return(!animationInfo.animationName.Equals(animator2D.get_animationName()));
     }
     return(true);
 }
コード例 #6
0
 public static bool HasAnimationEnded([NotNull] Animator2D animator2D, CharacterAnimationInfo animationInfo)
 {
     if (!animator2D.get_reachedEndOfAnimation())
     {
         return(!animationInfo.animationName.Equals(animator2D.get_animationName()));
     }
     return(true);
 }
コード例 #7
0
        protected override void PlayIdleAnimation()
        {
            //IL_0008: Unknown result type (might be due to invalid IL or missing references)
            //IL_000d: Unknown result type (might be due to invalid IL or missing references)
            CharacterAnimationInfo animationInfo = new CharacterAnimationInfo(Vector2Int.op_Implicit(m_cellObject.coords), "idle", "idle", loops: true, m_direction, m_mapRotation);

            StartFightAnimation(animationInfo, null, null, restart: false);
        }
コード例 #8
0
        public IEnumerator PlayHitAnimation()
        {
            CharacterAnimationInfo hitAnimationInfo = new CharacterAnimationInfo(Vector2Int.op_Implicit(m_cellObject.coords), "hit", "hit", loops: false, direction, m_mapRotation);

            StartFightAnimation(hitAnimationInfo, (Action)((CharacterObject)this).PlayIdleAnimation, (Action)null, restart: true, async: false);
            Animator2D animator = m_animator2D;

            while (!CharacterObjectUtility.HasAnimationReachedLabel(animator, hitAnimationInfo, "die"))
            {
                yield return(null);
            }
        }
コード例 #9
0
        public IEnumerator PlayLethalHitAnimation()
        {
            Animator2D animator            = m_animator2D;
            string     animationNameBackup = animator.get_animationName();

            yield return(null);

            if (string.Equals(animator.get_animationName(), animationNameBackup))
            {
                CharacterAnimationInfo animationInfo = new CharacterAnimationInfo(Vector2Int.op_Implicit(m_cellObject.coords), "hit", "hit", loops: false, direction, m_mapRotation);
                StartFightAnimation(animationInfo, (Action)((CharacterObject)this).PlayIdleAnimation, (Action)null, restart: true, async: false);
            }
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        public IEnumerator PlayActivationAnimation()
        {
            Animator2D animator = m_animator2D;

            if (!m_characterData.hasActivationAnimation)
            {
                Log.Warning(animator.GetDefinition().get_name() + " does not have an activation animation.", 204, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\ObjectMechanismObject.cs");
                yield break;
            }
            CharacterAnimationInfo activationAnimationInfo = new CharacterAnimationInfo(Vector2Int.op_Implicit(m_cellObject.coords), "attack", "attack", loops: false, direction, m_mapRotation);

            StartFightAnimation(activationAnimationInfo, (Action)((CharacterObject)this).PlayIdleAnimation, (Action)null, restart: true, async: false);
            while (!CharacterObjectUtility.HasAnimationReachedLabel(animator, activationAnimationInfo, "shot"))
            {
                yield return(null);
            }
            TriggerActivationEffect();
        }
コード例 #12
0
        protected override IEnumerator PlayDeathAnimation()
        {
            CharacterAnimationInfo deathAnimationInfo = new CharacterAnimationInfo(Vector2Int.op_Implicit(m_cellObject.coords), "hit", "death", loops: false, direction, m_mapRotation);

            StartFightAnimation(deathAnimationInfo, null, null, restart: false);
            Animator2D animator = m_animator2D;
            int        num      = default(int);

            if (animator.CurrentAnimationHasLabel("die", ref num))
            {
                while (!CharacterObjectUtility.HasAnimationReachedLabel(animator, deathAnimationInfo, "die"))
                {
                    yield return(null);
                }
                animator.set_paused(true);
            }
            else
            {
                Log.Warning(animator.GetDefinition().get_name() + " is missing the 'die' label in the animation named '" + deathAnimationInfo.animationName + "'.", 244, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\BoardCharacterObject.cs");
            }
        }
コード例 #13
0
        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;
            }
        }
コード例 #14
0
        protected unsafe IEnumerator MoveToRoutine(Vector2Int[] movementCells)
        {
            int movementCellsCount = movementCells.Length;

            if (movementCellsCount == 0)
            {
                yield break;
            }
            CellObject cellObj   = m_cellObject;
            IMap       parentMap = cellObj.parentMap;
            Animator2D animator  = m_animator2D;

            AnimatedFightCharacterData.IdleToRunTransitionMode idleToRunTransitionMode = m_characterData.idleToRunTransitionMode;
            Vector2Int startCell = movementCells[0];
            Vector2Int endCell   = movementCells[movementCellsCount - 1];

            if (cellObj.coords != startCell)
            {
                Log.Warning($"Was not on the start cell of a new movement sequence: {cellObj.coords} instead of {startCell} ({this.get_gameObject().get_name()}).", 232, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\FightCharacterObject.cs");
                CellObject cellObject = parentMap.GetCellObject(startCell.get_x(), startCell.get_y());
                SetCellObject(cellObject);
            }
            if (idleToRunTransitionMode.HasFlag(AnimatedFightCharacterData.IdleToRunTransitionMode.IdleToRun))
            {
                Direction direction = (movementCellsCount >= 2) ? startCell.GetDirectionTo(movementCells[1]) : this.direction;
                CharacterAnimationInfo transitionAnimationInfo2 = new CharacterAnimationInfo(Vector2Int.op_Implicit(startCell), "idle_run", "idle-to-run", loops: false, direction, m_mapRotation);
                StartFightAnimation(transitionAnimationInfo2);
                while (!CharacterObjectUtility.HasAnimationEnded(animator, transitionAnimationInfo2))
                {
                    yield return(null);
                }
            }
            Vector2Int val = startCell;
            float      cellTraversalDuration = ((movementCellsCount <= 2) ? 5f : 4f) / (float)animator.get_frameRate();

            foreach (CharacterAnimationInfo item in CharacterFightMovementSequencer.ComputeMovement(movementCells, m_mapRotation))
            {
                Vector2Int cellCoords   = item.position.RoundToInt();
                CellObject movementCell = parentMap.GetCellObject(cellCoords.get_x(), cellCoords.get_y());
                bool       goingUp      = ((IntPtr)(void *)movementCell.get_transform().get_position()).y >= ((IntPtr)(void *)cellObj.get_transform().get_position()).y;
                Vector2    innerPositionStart;
                Vector2    innerPositionEnd;
                if (goingUp)
                {
                    SetCellObject(movementCell);
                    innerPositionStart = Vector2Int.op_Implicit(val - cellCoords);
                    innerPositionEnd   = Vector2.get_zero();
                }
                else
                {
                    innerPositionStart = Vector2.get_zero();
                    innerPositionEnd   = Vector2Int.op_Implicit(cellCoords - val);
                }
                StartFightAnimation(item, null, null, restart: false);
                float animationTime = 0f;
                do
                {
                    Vector2 cellObjectInnerPosition = Vector2.Lerp(innerPositionStart, innerPositionEnd, animationTime / cellTraversalDuration);
                    SetCellObjectInnerPosition(cellObjectInnerPosition);
                    yield return(null);

                    animationTime += Time.get_deltaTime();
                }while (animationTime < cellTraversalDuration);
                SetCellObjectInnerPosition(innerPositionEnd);
                if (!goingUp)
                {
                    SetCellObject(movementCell);
                }
                val     = cellCoords;
                cellObj = movementCell;
                if (cellCoords != endCell && movementCell.TryGetIsoObject(out IObjectWithActivation isoObject))
                {
                    isoObject.PlayDetectionAnimation();
                }
                cellCoords = default(Vector2Int);
            }
            if (idleToRunTransitionMode.HasFlag(AnimatedFightCharacterData.IdleToRunTransitionMode.RunToIdle))
            {
                CharacterAnimationInfo transitionAnimationInfo2 = new CharacterAnimationInfo(Vector2Int.op_Implicit(val), "run_idle", "run-to-idle", loops: false, this.direction, m_mapRotation);
                StartFightAnimation(transitionAnimationInfo2);
                while (!CharacterObjectUtility.HasAnimationEnded(animator, transitionAnimationInfo2))
                {
                    yield return(null);
                }
            }
        }