Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public static Vector3 DrawPosition(Vector3 original, Pawn pawn, AlienRace.AlienPartGenerator.BodyAddon addon, Quaternion quat, Rot4 rotation)
        {
            Vector3         result = original;
            LinkedBodyAddon linked = addon as LinkedBodyAddon;

            if (linked != null && linked.alignWithHead)
            {
                Vector3 b = quat * pawn.Drawer.renderer.BaseHeadOffsetAt(rotation);
                Vector3 v = original + b;
                result = v;
                //    Log.Message("DrawPosition Original: " + original + " Modifier: " + b + " result: " + result);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public static Vector3 DrawOffset(Vector3 original, AlienRace.AlienPartGenerator.BodyAddon addon, Rot4 rotation)
        {
            Vector3         result = original;
            LinkedBodyAddon linked = addon as LinkedBodyAddon;

            if (linked != null && linked.useDefautZeroOffset)
            {
                Vector3 v = new Vector3(rotation == Rot4.North ? result.x : (result.x - (rotation == Rot4.East ? -0.42f : 0.42f)), result.y, result.z + (rotation == Rot4.North ? 0.55f : 0.22f));
                result = v;
                //    Log.Message("DrawOffset useDefautZeroOffset Original: " + original + " Modifier: " + v + " result: " + result);
            }

            /*
             * if (linked != null && linked.useHeadPosition)
             * {
             *  result = new Vector3();
             *  result += quat * pawn.Drawer.renderer.BaseHeadOffsetAt(rotation);
             *  Log.Message("DrawOffset useHeadPosition Original: " + original + " Modifier: " + pawn.Drawer.renderer.BaseHeadOffsetAt(rotation) + " result: " + result);
             * }
             */

            return(result);
        }