Ejemplo n.º 1
0
        public void CalcAndSetMoveCostToEnd(Component context)
        {
            float moveCost = this.moveCost;

            for (BoardSquarePathInfo next = this.next; next != null; next = next.next)
            {
                bool flag1 = context.Board.method_19(next.square, next.prev.square);
                bool flag2 = context.Board.method_18(next.square, next.prev.square);
                bool flag3 = next.square == next.prev.square;
                if (flag1)
                {
                    moveCost += 1.5f;
                }
                else if (flag2)
                {
                    ++moveCost;
                }
                else if (flag3)
                {
                    if (next.next != null)
                    {
                        Log.Print(LogType.Warning, "Calculating move costs on a path, but it has the same square twice in a row.");
                    }
                }
                else if (next.connectionType != ConnectionType.Run && next.connectionType != ConnectionType.Vault)
                {
                    moveCost += next.square.HorizontalDistanceOnBoardTo(next.prev.square);
                }
                else
                {
                    Log.Print(LogType.Warning, "Calculating move costs on a path, but it has two non-adjacent consecutive squares.");
                }
                next.moveCost = moveCost;
            }
        }
Ejemplo n.º 2
0
        public BoardSquarePathInfo Clone(BoardSquarePathInfo previous)
        {
            BoardSquarePathInfo previous1 = new BoardSquarePathInfo();

            previous1.square                    = square;
            previous1.moveCost                  = moveCost;
            previous1.heuristicCost             = heuristicCost;
            previous1.m_unskippable             = m_unskippable;
            previous1.m_reverse                 = m_reverse;
            previous1.chargeEndType             = chargeEndType;
            previous1.chargeCycleType           = chargeCycleType;
            previous1.segmentMovementSpeed      = segmentMovementSpeed;
            previous1.segmentMovementDuration   = segmentMovementDuration;
            previous1.connectionType            = connectionType;
            previous1.m_moverDiesHere           = m_moverDiesHere;
            previous1.m_moverHasGameplayHitHere = m_moverHasGameplayHitHere;
            previous1.m_updateLastKnownPos      = m_updateLastKnownPos;
            previous1.m_visibleToEnemies        = m_visibleToEnemies;
            previous1.m_moverClashesHere        = m_moverClashesHere;
            previous1.m_moverBumpedFromClash    = m_moverBumpedFromClash;
            if (previous != null)
            {
                previous1.prev = previous;
            }
            if (next != null)
            {
                previous1.next = next.Clone(previous1);
            }
            return(previous1);
        }
Ejemplo n.º 3
0
        internal float FindDistanceToEnd()
        {
            var num = 0.0f;

            for (var next = this.next; next != null; next = next.next)
            {
                num += (next.square.ToVector3() - square.ToVector3()).Length();
            }
            return(num);
        }
Ejemplo n.º 4
0
        public float FindMoveCostToOneBeforeEnd()
        {
            var moveCost = this.moveCost;

            for (var next = this.next; next != null && next.next != null; next = next.next)
            {
                moveCost = next.moveCost;
            }
            return(moveCost - this.moveCost);
        }
Ejemplo n.º 5
0
//        public void CalcAndSetMoveCostToEnd()
//        {
//            float moveCost = this.moveCost;
//            for (BoardSquarePathInfo next = this.next; next != null; next = next.next)
//            {
//                bool flag1 = Board.smethod_0().method_19(next.square, next.prev.square);
//                bool flag2 = Board.smethod_0().method_18(next.square, next.prev.square);
//                bool flag3 = next.square == next.prev.square;
//                if (flag1)
//                    moveCost += 1.5f;
//                else if (flag2)
//                    ++moveCost;
//                else if (flag3)
//                {
//                    if (next.next != null)
//                        Log.Print(LogType.Warning,
//                            "Calculating move costs on a path, but it has the same square twice in a row.");
//                }
//                else if (next.connectionType != ConnectionType.Run && next.connectionType != ConnectionType.Vault)
//                    moveCost += next.square.HorizontalDistanceOnBoardTo(next.prev.square);
//                else
//                    Log.Print(LogType.Warning,
//                        "Calculating move costs on a path, but it has two non-adjacent consecutive squares.");
//
//                next.moveCost = moveCost;
//            }
//        }

        public float FindMoveCostToEnd()
        {
            float moveCost = this.moveCost;

            for (BoardSquarePathInfo next = this.next; next != null; next = next.next)
            {
                moveCost = next.moveCost;
            }
            return(moveCost - this.moveCost);
        }
Ejemplo n.º 6
0
 public void ResetClashingOfPath()
 {
     for (BoardSquarePathInfo boardSquarePathInfo = this;
          boardSquarePathInfo != null;
          boardSquarePathInfo = boardSquarePathInfo.next)
     {
         if (boardSquarePathInfo.m_moverClashesHere)
         {
             boardSquarePathInfo.m_moverClashesHere = false;
         }
         if (boardSquarePathInfo.m_moverBumpedFromClash)
         {
             boardSquarePathInfo.m_moverBumpedFromClash = false;
         }
     }
 }
Ejemplo n.º 7
0
 public void ResetValuesToDefault()
 {
     square                    = null;
     moveCost                  = 0.0f;
     heuristicCost             = 0.0f;
     prev                      = null;
     next                      = null;
     m_unskippable             = false;
     m_reverse                 = false;
     m_visibleToEnemies        = false;
     m_updateLastKnownPos      = false;
     m_moverDiesHere           = false;
     m_moverHasGameplayHitHere = false;
     m_moverClashesHere        = false;
     m_moverBumpedFromClash    = false;
     m_expectedBackupNum       = 0;
 }
Ejemplo n.º 8
0
        public bool IsNodePartOfMyFuturePath(BoardSquarePathInfo other, bool includePresent = true)
        {
            bool flag = false;

            for (BoardSquarePathInfo boardSquarePathInfo = !includePresent ? next : this;
                 boardSquarePathInfo != null;
                 boardSquarePathInfo = boardSquarePathInfo.next)
            {
                if (other == boardSquarePathInfo)
                {
                    flag = true;
                    break;
                }
            }

            return(flag);
        }
Ejemplo n.º 9
0
        public bool IsSamePathAs(BoardSquarePathInfo other)
        {
            if (other == null)
            {
                return(false);
            }
            bool flag1 = true;
            bool flag2;

            if (flag2 =
                    (flag1 =
                         (flag1 =
                              (flag1 =
                                   (flag1 =
                                        (flag1 =
                                             (flag1 =
                                                  (flag1 =
                                                       (flag1 = (flag1 = (flag1 = (1 & (other.square == square ? 1 : 0)) != 0) &
                                                                         other.moveCost == (double)moveCost) &
                                                                other.heuristicCost == (double)heuristicCost) &
                                                       other.m_unskippable == m_unskippable) &
                                                  (other.m_moverClashesHere = m_moverClashesHere)) &
                                             (other.m_moverBumpedFromClash = m_moverBumpedFromClash)) &
                                        other.m_reverse == m_reverse) & other.chargeEndType == chargeEndType) &
                              other.chargeCycleType == chargeCycleType) &
                         other.segmentMovementSpeed == (double)segmentMovementSpeed) &
                    other.segmentMovementDuration == (double)segmentMovementDuration)
            {
                if (next != null && other.next != null)
                {
                    flag2 = next.IsSamePathAs(other.next);
                }
                else if (next == null && other.next != null)
                {
                    flag2 = false;
                }
                else if (next != null && other.next == null)
                {
                    flag2 = false;
                }
            }

            return(flag2);
        }
Ejemplo n.º 10
0
        public BoardSquarePathInfo GetPathMidpoint()
        {
            var moveCostToEnd1      = FindMoveCostToEnd();
            var num1                = moveCostToEnd1 / 2f;
            var boardSquarePathInfo = this;
            var num2                = moveCostToEnd1;

            for (var next = this.next; next != null; next = next.next)
            {
                var moveCostToEnd2 = next.FindMoveCostToEnd();
                if (Math.Abs(moveCostToEnd2 - num1) < (double)Math.Abs(num2 - num1))
                {
                    boardSquarePathInfo = next;
                    num2 = moveCostToEnd2;
                }
                else
                {
                    break;
                }
            }

            return(boardSquarePathInfo);
        }