예제 #1
0
        public virtual void SetCellObject([NotNull] CellObject containerCell)
        {
            //IL_0010: Unknown result type (might be due to invalid IL or missing references)
            //IL_001b: Unknown result type (might be due to invalid IL or missing references)
            //IL_002f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0034: Unknown result type (might be due to invalid IL or missing references)
            //IL_0039: Unknown result type (might be due to invalid IL or missing references)
            //IL_0040: Unknown result type (might be due to invalid IL or missing references)
            //IL_0045: Unknown result type (might be due to invalid IL or missing references)
            //IL_004a: Unknown result type (might be due to invalid IL or missing references)
            //IL_0051: Unknown result type (might be due to invalid IL or missing references)
            //IL_0056: Unknown result type (might be due to invalid IL or missing references)
            //IL_005b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0073: 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_007a: Unknown result type (might be due to invalid IL or missing references)
            //IL_007f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0087: Unknown result type (might be due to invalid IL or missing references)
            //IL_008c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0098: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ba: Unknown result type (might be due to invalid IL or missing references)
            //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
            //IL_00dc: Unknown result type (might be due to invalid IL or missing references)
            //IL_00e1: Unknown result type (might be due to invalid IL or missing references)
            //IL_00e6: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ed: Unknown result type (might be due to invalid IL or missing references)
            if (containerCell == m_cellObject)
            {
                return;
            }
            float     num       = Vector3.Dot(m_localUpVector, this.get_transform().get_localPosition());
            Transform transform = containerCell.get_transform();

            m_localRightVector   = transform.InverseTransformDirection(Vector3.get_right());
            m_localForwardVector = transform.InverseTransformDirection(Vector3.get_forward());
            m_localUpVector      = transform.InverseTransformDirection(Vector3.get_up());
            this.get_transform().SetParent(transform, true);
            Vector3 localPosition = this.get_transform().get_localPosition();
            float   num2          = Vector3.Dot(m_localRightVector, localPosition);
            float   num3          = Vector3.Dot(m_localForwardVector, localPosition);

            innerCellPosition = new Vector2(num2, num3);
            if (null == m_cellObject)
            {
                containerCell.AcquireIsoObject(this);
            }
            else
            {
                float num4 = Vector3.Dot(m_localUpVector, localPosition);
                if (!Mathf.Approximately(num, num4))
                {
                    localPosition += m_localUpVector * (num - num4);
                    this.get_transform().set_localPosition(localPosition);
                }
                containerCell.AcquireIsoObject(this, m_cellObject);
            }
            m_cellObject = containerCell;
        }
예제 #2
0
        public void TriggerActionEffect(Vector2Int target)
        {
            CharacterEffect actionEffect = m_characterData.actionEffect;

            if (!(null == actionEffect))
            {
                CellObject cellObject = m_cellObject.parentMap.GetCellObject(target.get_x(), target.get_y());
                Component  val        = actionEffect.Instantiate(cellObject.get_transform(), this);
                if (null != val)
                {
                    this.StartCoroutine(actionEffect.DestroyWhenFinished(val));
                }
            }
        }
예제 #3
0
        public unsafe void SetCellObject([CanBeNull] CellObject previousCell, [NotNull] CellObject containerCell)
        {
            //IL_0069: Unknown result type (might be due to invalid IL or missing references)
            //IL_0079: Unknown result type (might be due to invalid IL or missing references)
            //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
            //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
            //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
            //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
            //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
            //IL_00c9: 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)
            //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d9: Unknown result type (might be due to invalid IL or missing references)
            //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
            //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ee: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
            DynamicObject parent = m_parent;

            if (null == parent)
            {
                if (null == previousCell)
                {
                    containerCell.AddRootDynamicObject(this);
                }
                else
                {
                    float num = containerCell.AcquireRootDynamicObject(this, previousCell);
                    m_localHeight += num;
                }
            }
            else
            {
                parent.m_children.Remove(this);
                if (null == previousCell)
                {
                    containerCell.AddRootDynamicObject(this);
                }
                else
                {
                    float num2 = containerCell.AcquireDynamicObject(this, previousCell);
                    float num3 = ((IntPtr)(void *)this.get_transform().get_position()).y - (((IntPtr)(void *)previousCell.get_transform().get_position()).y + 0.5f);
                    m_localHeight = num2 + num3;
                }
            }
            m_localUpVector = this.get_transform().get_parent().InverseTransformDirection(Vector3.get_up());
            if (m_localHeight <= 0f)
            {
                Vector3 localPosition = this.get_transform().get_localPosition();
                localPosition += m_localUpVector * (0.5f - Vector3.Dot(localPosition, m_localUpVector));
                this.get_transform().set_localPosition(localPosition);
                m_localHeight       = 0f;
                m_inheritedVelocity = 0f;
            }
        }
예제 #4
0
        protected unsafe IEnumerator SlideRoutine(Vector2Int[] movementCells, bool followDirection)
        {
            int movementCellsCount = movementCells.Length;

            if (movementCellsCount == 0)
            {
                yield break;
            }
            CellObject cellObject = base.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()}).", 528, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Maps\\Objects\\CharacterObject.cs");
                CellObject cellObject2 = parentMap.GetCellObject(val.get_x(), val.get_y());
                SetCellObject(cellObject2);
            }
            if (movementCellsCount > 1)
            {
                Direction direction = followDirection ? val.GetDirectionTo(movementCells[1]) : movementCells[1].GetDirectionTo(val);
                if (!direction.IsAxisAligned())
                {
                    direction = direction.GetAxisAligned(this.direction);
                }
                ChangeDirection(direction);
            }
            Vector2Int val2 = val;
            float      cellTraversalDuration = 2f / (float)GetAnimator().get_frameRate();
            int        num;

            for (int i = 1; i < movementCellsCount; i = num)
            {
                Vector2Int cellCoords   = movementCells[i];
                CellObject movementCell = parentMap.GetCellObject(cellCoords.get_x(), cellCoords.get_y());
                bool       goingUp      = ((IntPtr)(void *)movementCell.get_transform().get_position()).y >= ((IntPtr)(void *)cellObject.get_transform().get_position()).y;
                Vector2    innerPositionStart;
                Vector2    innerPositionEnd;
                if (goingUp)
                {
                    SetCellObject(movementCell);
                    innerPositionStart = Vector2Int.op_Implicit(val2 - cellCoords);
                    innerPositionEnd   = Vector2.get_zero();
                }
                else
                {
                    innerPositionStart = Vector2.get_zero();
                    innerPositionEnd   = Vector2Int.op_Implicit(cellCoords - val2);
                }
                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);
                }
                val2       = cellCoords;
                cellObject = movementCell;
                if (i < movementCellsCount - 1 && movementCell.TryGetIsoObject(out IObjectWithActivation isoObject))
                {
                    isoObject.PlayDetectionAnimation();
                }
                cellCoords = default(Vector2Int);
                num        = i + 1;
            }
        }
예제 #5
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);
                }
            }
        }