コード例 #1
0
        public static void GetSpecifities(this InnerShineItem ISI, Pawn p, out Vector3 offset, out float scale)
        {
            offset = Vector3.zero;
            scale  = 1;

            if (p.story?.bodyType == null || !ISI.HasBodyTypeDrawRules)
            {
                if (ISI.HasDefaultDrawRules)
                {
                    offset = ISI.defaultDrawRules.GetRotationOffset(p);
                    scale  = ISI.defaultDrawRules.randomScale.RandomInRange;
                }
                return;
            }

            BodyTypeSpecificities BTS = ISI.bodyTypeDrawRules.Where(b => b.bodyTypeDef == p.story.bodyType).FirstOrFallback();

            if (BTS == null)
            {
                if (ISI.HasDefaultDrawRules)
                {
                    offset = ISI.defaultDrawRules.GetRotationOffset(p);
                    scale  = ISI.defaultDrawRules.randomScale.RandomInRange;
                }

                return;
            }

            offset = BTS.drawRules.GetRotationOffset(p);
            scale  = BTS.drawRules.randomScale.RandomInRange;
        }
コード例 #2
0
        public static Vector3 GetDrawOffset(this InnerShineItem ISI, Pawn p)
        {
            if (p.story?.bodyType == null || !ISI.HasBodyTypeDrawRules)
            {
                if (ISI.HasDefaultDrawRules)
                {
                    return(ISI.defaultDrawRules.GetRotationOffset(p));
                }
                else
                {
                    return(Vector3.zero);
                }
            }

            BodyTypeSpecificities BTS = ISI.bodyTypeDrawRules.Where(b => b.bodyTypeDef == p.story.bodyType).FirstOrFallback();

            if (BTS == null)
            {
                return(ISI.HasDefaultDrawRules ? ISI.defaultDrawRules.GetRotationOffset(p) : Vector3.zero);
            }

            return(BTS.drawRules.GetRotationOffset(p));
        }