예제 #1
0
        private static int CostToMoveIntoCell(Pawn pawn, IntVec3 c)
        {
            int num;

            if (c.x == pawn.Position.x || c.z == pawn.Position.z)
            {
                num = pawn.TicksPerMoveCardinal;
            }
            else
            {
                num = pawn.TicksPerMoveDiagonal;
            }
            num += pawn.Map.pathGrid.CalculatedCostAt(c, false, pawn.Position);
            Building edifice = c.GetEdifice(pawn.Map);

            if (edifice != null)
            {
                num += (int)edifice.PathWalkCostFor(pawn);
            }
            if (num > 450)
            {
                num = 450;
            }
            if (pawn.CurJob != null)
            {
                Pawn locomotionUrgencySameAs = pawn.jobs.curDriver.locomotionUrgencySameAs;
                if (locomotionUrgencySameAs != null && locomotionUrgencySameAs != pawn && locomotionUrgencySameAs.Spawned)
                {
                    int num2 = Pawn_PathFollower.CostToMoveIntoCell(locomotionUrgencySameAs, c);
                    if (num < num2)
                    {
                        num = num2;
                    }
                }
                else
                {
                    switch (pawn.jobs.curJob.locomotionUrgency)
                    {
                    case LocomotionUrgency.Amble:
                        num *= 3;
                        if (num < 60)
                        {
                            num = 60;
                        }
                        break;

                    case LocomotionUrgency.Walk:
                        num *= 2;
                        if (num < 50)
                        {
                            num = 50;
                        }
                        break;

                    case LocomotionUrgency.Jog:
                        num = num;
                        break;

                    case LocomotionUrgency.Sprint:
                        num = Mathf.RoundToInt((float)num * 0.75f);
                        break;
                    }
                }
            }
            return(Mathf.Max(num, 1));
        }
예제 #2
0
 private int CostToMoveIntoCell(IntVec3 c)
 {
     return(Pawn_PathFollower.CostToMoveIntoCell(this.pawn, c));
 }