Пример #1
0
        public static AlienPartGenerator.RotationOffset DrawOffsets(AlienPartGenerator.RotationOffset original, Pawn pawn, AlienRace.AlienPartGenerator.BodyAddon addon)
        {
            AlienPartGenerator.RotationOffset result = original;
            LinkedBodyAddon linked = addon as LinkedBodyAddon;

            if (linked != null && linked.alignWithHead)
            {
                ThingDef_AlienRace thingDef_AlienRace = pawn.def as ThingDef_AlienRace;
                GraphicPaths       paths = thingDef_AlienRace.alienRace.graphicPaths.GetCurrentGraphicPath(pawn.ageTracker.CurLifeStage);
                result           = new AlienPartGenerator.RotationOffset();
                result.bodyTypes = original.bodyTypes;

                /*
                 * for (int i = 0; i < result.bodyTypes.Count; i++)
                 * {
                 *  AlienPartGenerator.BodyTypeOffset body = result.bodyTypes[i];
                 *  body.offset += linked.useHeadDrawSize ? paths.hea : paths.customDrawSize
                 * }
                 */
                result.crownTypes = original.crownTypes;
                for (int i = 0; i < result.crownTypes.Count; i++)
                {
                    AlienPartGenerator.CrownTypeOffset body = result.crownTypes[i];
                    body.offset += paths.headOffsetDirectional?.GetOffset(pawn.Rotation) ?? Vector2.zero;
                }
                Log.Message("DrawOffsets result: " + result);
            }

            return(result);
        }
Пример #2
0
        private static List <GraphicPaths> GenerateGraphicPaths(List <GraphicPaths> humanGraphicPaths, MorphDef morph)
        {
            GraphicPaths temp       = new GraphicPaths();
            Vector2?     customSize = morph?.raceSettings?.graphicsSettings?.customDrawSize;

            temp.customDrawSize         = customSize ?? temp.customDrawSize;
            temp.customPortraitDrawSize = customSize ?? temp.customPortraitDrawSize;
            Vector2?customHeadSize = morph?.raceSettings?.graphicsSettings?.customHeadDrawSize;

            temp.customHeadDrawSize         = customHeadSize ?? temp.customHeadDrawSize;
            temp.customPortraitHeadDrawSize = customHeadSize ?? temp.customPortraitHeadDrawSize;
            temp.headOffset            = customSize != null ? new Vector2(0f, 0.34f * (morph.raceSettings.graphicsSettings.customDrawSize.GetValueOrDefault().y - 1)) : temp.headOffset;
            temp.headOffsetDirectional = humanGraphicPaths.First().headOffsetDirectional;
            List <GraphicPaths> returnList = new List <GraphicPaths>();

            returnList.Add(temp);
            return(returnList);
        }