コード例 #1
0
        public static bool Prefix(ref SubRoot __instance)
        {
            var cyclopsLife = (LiveMixin)__instance.GetInstanceField("live");

            if (__instance.upgradeConsole == null || !cyclopsLife.IsAlive())
            {
                return(true); // safety check
            }
            __instance.shieldUpgrade                = false;
            __instance.sonarUpgrade                 = false;
            __instance.vehicleRepairUpgrade         = false;
            __instance.decoyTubeSizeIncreaseUpgrade = false;

            bool hasFireSupression = false;

            HandleToggleableUpgrades(__instance, __instance.upgradeConsole.modules, ref hasFireSupression);

            foreach (AuxUpgradeConsole auxConsole in UpgradeConsoleCache.AuxUpgradeConsoles)
            {
                HandleToggleableUpgrades(__instance, auxConsole.Modules, ref hasFireSupression);
            }

            var cyclopsHUD = __instance.GetComponentInChildren <CyclopsHolographicHUD>();

            cyclopsHUD.fireSuppressionSystem.SetActive(hasFireSupression);

            // No need to execute original method anymore
            return(false); // Completely override the method and do not continue with original execution
        }
コード例 #2
0
        public static bool Prefix(ref SubRoot __instance)
        {
            var cyclopsLife = (LiveMixin)__instance.GetInstanceField("live");

            if (cyclopsLife == null || !cyclopsLife.IsAlive())
            {
                return(true); // safety check
            }
            UpgradeManager upgradeMgr = CyclopsManager.GetUpgradeManager(__instance);

            if (upgradeMgr == null)
            {
                return(true); // safety check
            }

            upgradeMgr.HandleUpgrades();

            // No need to execute original method anymore
            return(false); // Completely override the method and do not continue with original execution
        }