Exemple #1
0
        public static void DrawMeshModified(Mesh mesh, Vector3 position, Quaternion rotation, Material mat, int layer, Thing eq, float aimAngle)
        {
            CompOversizedWeapon compOversized = eq.TryGetComp <CompOversizedWeapon>();
            CompEquippable      equippable    = eq.TryGetComp <CompEquippable>();
            Pawn pawn = equippable.PrimaryVerb.CasterPawn;

            if (pawn == null)
            {
                return;
            }
            if (compOversized == null || (compOversized != null && compOversized.CompDeflectorIsAnimatingNow) || pawn == null || eq == null)
            {
                draw(mesh, default(Matrix4x4), mat, layer, eq, pawn, position, rotation);
                return;
            }
            ThingWithComps  thingWithComps  = eq as ThingWithComps;
            bool            DualWeapon      = compOversized.Props != null && compOversized.Props.isDualWeapon;
            float           offHandAngle    = aimAngle;
            float           mainHandAngle   = aimAngle;
            Stance_Busy     stance_Busy     = pawn.stances.curStance as Stance_Busy;
            LocalTargetInfo localTargetInfo = null;

            if (stance_Busy != null && !stance_Busy.neverAimWeapon)
            {
                localTargetInfo = stance_Busy.focusTarg;
            }
            bool    Aiming         = Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.CurrentlyAiming(stance_Busy);
            Vector3 offsetMainHand = default(Vector3);
            Vector3 offsetOffHand  = default(Vector3);

            if (compOversized.Props != null)
            {
                Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.SetAnglesAndOffsets(eq, thingWithComps, aimAngle, pawn, ref offsetMainHand, ref offsetOffHand, ref offHandAngle, ref mainHandAngle, Aiming, DualWeapon && Aiming);
            }
            if (DualWeapon)
            {
                Vector3 drawLoc = position + offsetMainHand;
                compOversized.renderPos = drawLoc;
                Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.DrawEquipmentAimingOverride(mesh, eq, drawLoc, offHandAngle, compOversized, equippable, pawn);
            }

            if (Aiming && localTargetInfo != null)
            {
                mainHandAngle     = Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.GetAimingRotation(pawn, localTargetInfo);
                offsetMainHand.y += 0.1f;
                Vector3 drawLoc2 = pawn.DrawPos + new Vector3(0f, 0f, 0.4f).RotatedBy(mainHandAngle) + (DualWeapon ? offsetOffHand : offsetMainHand);
                if (DualWeapon)
                {
                    compOversized.renderPosDual = drawLoc2;
                }
                else
                {
                    compOversized.renderPos = drawLoc2;
                }
                Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.DrawEquipmentAimingOverride(mesh, thingWithComps, drawLoc2, (DualWeapon ? mainHandAngle : aimAngle), compOversized, equippable, pawn, DualWeapon);
            }
            else
            {
                Vector3 drawLoc2 = position + (DualWeapon ? offsetOffHand : offsetMainHand);
                if (DualWeapon)
                {
                    compOversized.renderPosDual = drawLoc2;
                }
                else
                {
                    compOversized.renderPos = drawLoc2;
                }
                Harmony_PawnRenderer_DrawEquipmentAiming_Transpiler.DrawEquipmentAimingOverride(mesh, thingWithComps, drawLoc2, (DualWeapon ? mainHandAngle : aimAngle), compOversized, equippable, pawn, false);
            }
        }