Esempio n. 1
0
        static bool Prefix(WeaponEffect __instance)
        {
            var multiplier  = SizeMultiplier.Get(__instance.weapon.weaponDef);
            var ogTransform = Traverse.Create(__instance).Field("projectileTransform").GetValue <Transform>();

            ogTransform.localScale = multiplier;
            Traverse.Create(__instance).Field("projectileTransform").SetValue(ogTransform);
            return(true);
        }
        static void Postfix(
            Mech mech,
            Transform parentTransform,
            bool isParented,
            MechRepresentation __instance)
        {
            Logger.Debug("mech size initialization");
            var identifier     = mech.MechDef.ChassisID;
            var sizeMultiplier = SizeMultiplier.Get(mech.MechDef.Chassis);

            Logger.Debug($"{identifier}: {sizeMultiplier}");
            var originalLOSSourcePositions = Traverse.Create(mech).Field("originalLOSSourcePositions").GetValue <Vector3[]>();
            var originalLOSTargetPositions = Traverse.Create(mech).Field("originalLOSTargetPositions").GetValue <Vector3[]>();
            var newSourcePositions         = ModSettings.LOSSourcePositions(identifier, originalLOSSourcePositions, sizeMultiplier);
            var newTargetPositions         = ModSettings.LOSTargetPositions(identifier, originalLOSTargetPositions, sizeMultiplier);

            Traverse.Create(mech).Field("originalLOSSourcePositions").SetValue(newSourcePositions);
            Traverse.Create(mech).Field("originalLOSTargetPositions").SetValue(newTargetPositions);
            Traverse.Create(__instance.thisTransform).Property("localScale").SetValue(sizeMultiplier);
        }