public static Vector3 PawnCollisionPosOffsetFor(Pawn pawn)
        {
            if (pawn.GetPosture() != PawnPosture.Standing)
            {
                return(Vector3.zero);
            }
            bool flag = pawn.Spawned && pawn.pather.MovingNow;

            if (!flag || pawn.pather.nextCell == pawn.pather.Destination.Cell)
            {
                if (!flag && pawn.Drawer.leaner.ShouldLean())
                {
                    return(Vector3.zero);
                }
                IntVec3 at;
                if (flag)
                {
                    at = pawn.pather.nextCell;
                }
                else
                {
                    at = pawn.Position;
                }
                int  polygonVertices;
                int  vertexIndex;
                bool flag2;
                PawnCollisionTweenerUtility.GetPawnsStandingAtOrAboutToStandAt(at, pawn.Map, out polygonVertices, out vertexIndex, out flag2, pawn);
                if (!flag2)
                {
                    return(Vector3.zero);
                }
                return(GenGeo.RegularPolygonVertexPositionVec3(polygonVertices, vertexIndex) * 0.32f);
            }
            else
            {
                IntVec3 nextCell = pawn.pather.nextCell;
                if (PawnCollisionTweenerUtility.CanGoDirectlyToNextCell(pawn))
                {
                    return(Vector3.zero);
                }
                int num = pawn.thingIDNumber % 2;
                if (nextCell.x != pawn.Position.x)
                {
                    if (num == 0)
                    {
                        return(new Vector3(0f, 0f, 0.32f));
                    }
                    return(new Vector3(0f, 0f, -0.32f));
                }
                else
                {
                    if (num == 0)
                    {
                        return(new Vector3(0.32f, 0f, 0f));
                    }
                    return(new Vector3(-0.32f, 0f, 0f));
                }
            }
        }
Exemple #2
0
        public static Vector3 PawnCollisionPosOffsetFor(Pawn pawn)
        {
            if (pawn.GetPosture() != 0)
            {
                return(Vector3.zero);
            }
            bool flag = pawn.Spawned && pawn.pather.MovingNow;

            if (!flag || pawn.pather.nextCell == pawn.pather.Destination.Cell)
            {
                if (!flag && pawn.Drawer.leaner.ShouldLean())
                {
                    return(Vector3.zero);
                }
                IntVec3 at = (!flag) ? pawn.Position : pawn.pather.nextCell;
                GetPawnsStandingAtOrAboutToStandAt(at, pawn.Map, out int pawnsCount, out int pawnsWithLowerIdCount, out bool forPawnFound, pawn);
                if (!forPawnFound)
                {
                    return(Vector3.zero);
                }
                return(GenGeo.RegularPolygonVertexPositionVec3(pawnsCount, pawnsWithLowerIdCount) * 0.32f);
            }
            IntVec3 nextCell = pawn.pather.nextCell;

            if (CanGoDirectlyToNextCell(pawn))
            {
                return(Vector3.zero);
            }
            int     num      = pawn.thingIDNumber % 2;
            int     x        = nextCell.x;
            IntVec3 position = pawn.Position;

            if (x != position.x)
            {
                if (num == 0)
                {
                    return(new Vector3(0f, 0f, 0.32f));
                }
                return(new Vector3(0f, 0f, -0.32f));
            }
            if (num == 0)
            {
                return(new Vector3(0.32f, 0f, 0f));
            }
            return(new Vector3(-0.32f, 0f, 0f));
        }