internal void FastUpdate(CyclopsHelmHUDManager cyclopsHelmHUD)
        {
            if (!powerIconsInitialized)
            {
                AddStatusIcons(cyclopsHelmHUD);
            }
            else
            {
                UpdateStatusIcons();
            }

            PowerRelay powerRelay = Cyclops.powerRelay;

            switch (settings.EnergyDisplay)
            {
            case HelmEnergyDisplay.PowerCellAmount:
                cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower());
                break;

            case HelmEnergyDisplay.PercentageOverPowerCells:
                float percentOver = (powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower()) / powerRelay.GetMaxPower();
                cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percentOver * 100f)}%";
                break;

            case HelmEnergyDisplay.CombinedAmount:
                cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower());
                break;

            default:     // HelmEnergyDisplay.PowerCellPercentage:
                float percent = powerRelay.GetPower() / powerRelay.GetMaxPower();
                cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percent * 100f)}%";
                break;
            }
        }
Пример #2
0
        public static void Postfix(CyclopsHelmHUDManager __instance)
        {
            NitroxId id = NitroxEntity.GetId(__instance.subRoot.gameObject);

            __instance.hudActive = true;
            Resolve <Cyclops>().BroadcastChangeSonarState(id, false);
        }
        /// <summary>
        /// Updates the Cyclops helm HUD  using data from all equipment modules across all upgrade consoles.
        /// </summary>
        /// <param name="__instance">The instance.</param>
        /// <param name="modules">The modules.</param>
        /// <param name="auxUpgradeConsoles">The aux upgrade consoles.</param>
        /// <param name="lastReservePower">The last reserve power.</param>
        internal static void UpdateHelmHUD(ref CyclopsHelmHUDManager __instance, Equipment modules, IList <AuxUpgradeConsole> auxUpgradeConsoles, ref int lastReservePower)
        {
            int currentReservePower = GetTotalReservePower(modules, auxUpgradeConsoles);

            if (currentReservePower > 0f)
            {
                __instance.powerText.color = Color.cyan; // Distinct color for when reserve power is available
            }
            else
            {
                __instance.powerText.color = Color.white; // Normal color
            }

            if (lastReservePower != currentReservePower)
            {
                float availablePower = currentReservePower + __instance.subRoot.powerRelay.GetPower();

                float availablePowerRatio = availablePower / __instance.subRoot.powerRelay.GetMaxPower();

                // Min'd with 999 since this textbox can only display 4 characeters
                int percentage = Mathf.Min(999, Mathf.CeilToInt(availablePowerRatio * 100f));

                __instance.powerText.text = $"{percentage}%";

                lastReservePower = currentReservePower;
            }
        }
Пример #4
0
 static void CyclopsHelmHUDManager_Update_Postfix(CyclopsHelmHUDManager __instance)
 {
     if (__instance.LOD.IsFull() && __instance.engineOffText.gameObject.activeSelf)
     {
         __instance.engineOffText.gameObject.SetActive(false);
     }
 }
        /// <summary>
        /// Updates the Cyclops helm HUD  using data from all equipment modules across all upgrade consoles.
        /// </summary>
        /// <param name="cyclopsHelmHUD">The instance.</param>
        /// <param name="lastReservePower">The last reserve power.</param>
        internal void UpdateHelmHUD(CyclopsHelmHUDManager cyclopsHelmHUD, ref int lastReservePower)
        {
            if (this.UpgradeManager == null)
            {
                ErrorMessage.AddMessage("UpdateHelmHUD: UpgradeManager is null");
                return;
            }

            int currentReservePower = GetTotalReservePower();

            if (currentReservePower > 0f)
            {
                cyclopsHelmHUD.powerText.color = Color.cyan; // Distinct color for when reserve power is available
            }
            else
            {
                cyclopsHelmHUD.powerText.color = Color.white; // Normal color
            }

            if (lastReservePower != currentReservePower)
            {
                float availablePower = currentReservePower + this.Cyclops.powerRelay.GetPower();

                float availablePowerRatio = availablePower / this.Cyclops.powerRelay.GetMaxPower();

                // Min'd with 999 since this textbox can only display 4 characeters
                int powerPercentage = Mathf.Min(999, Mathf.CeilToInt(availablePowerRatio * 100f));

                cyclopsHelmHUD.powerText.text = $"{powerPercentage}%";

                lastReservePower = currentReservePower;
            }
        }
Пример #6
0
        public static void Postfix(CyclopsHelmHUDManager __instance)
        {
            CyclopsModel cyclops = Resolve <Vehicles>().GetVehicles <CyclopsModel>(NitroxEntity.GetId(__instance.subRoot.gameObject));

            __instance.hudActive = true;
            __instance.engineToggleAnimator.SetTrigger(cyclops.EngineState ? "EngineOn" : "EngineOff");
        }
Пример #7
0
 public static void Prefix(ref CyclopsHelmHUDManager __instance, ref int __state)
 {
     __state = -1;
     if (__instance.subLiveMixin.IsAlive() && __instance.subRoot != null)
     {
         // Should prevent the powerText from getting updated normally
         __state = __instance.lastPowerPctUsedForString;
         float ratioNum = __instance.subRoot.powerRelay.GetPower() / __instance.subRoot.powerRelay.GetMaxPower();
         __instance.lastPowerPctUsedForString = Mathf.CeilToInt(ratioNum * 100f);
     }
 }
        public static void Postfix(ref CyclopsHelmHUDManager __instance)
        {
            CyclopsHUDManager hudMgr = CyclopsManager.GetHUDManager(__instance.subRoot);

            if (hudMgr == null)
            {
                return;
            }

            hudMgr.UpdateHelmHUD(__instance);
        }
 public static void Postfix(CyclopsHelmHUDManager __instance)
 {
     // To show the Cyclops HUD every time "hudActive" have to be true. "hornObject" is a good indicator to check if the player piloting the cyclops.
     if (!__instance.hornObject.activeSelf && (bool)__instance.ReflectionGet("hudActive"))
     {
         __instance.canvasGroup.interactable = false;
     }
     else if (!(bool)__instance.ReflectionGet("hudActive"))
     {
         __instance.ReflectionSet("hudActive", true);
     }
 }
 public static void Postfix(CyclopsHelmHUDManager __instance)
 {
     __instance.ReflectionSet("hudActive", true);
     if (__instance.motorMode.engineOn)
     {
         __instance.engineToggleAnimator.SetTrigger("EngineOn");
     }
     else
     {
         __instance.engineToggleAnimator.SetTrigger("EngineOff");
     }
 }
Пример #11
0
        public static void Postfix(ref CyclopsHelmHUDManager __instance)
        {
            if (!__instance.LOD.IsFull() ||         // can't see
                !__instance.subLiveMixin.IsAlive()) // dead
            {
                return;
            }

            UpgradeConsole upgradeConsole = __instance.subRoot.upgradeConsole;

            if (upgradeConsole == null)
            {
                return; // safety check
            }
            PowerManager.UpdateHelmHUD(ref __instance, upgradeConsole.modules, UpgradeConsoleCache.AuxUpgradeConsoles, ref lastReservePower);
        }
        public static bool Prefix(CyclopsMotorModeButton __instance, out bool __state)
        {
            SubRoot cyclops = (SubRoot)__instance.ReflectionGet("subRoot");

            if (cyclops != null && cyclops == Player.main.currentSub)
            {
                CyclopsHelmHUDManager cyclops_HUD = cyclops.gameObject.RequireComponentInChildren <CyclopsHelmHUDManager>();
                //To show the Cyclops HUD every time "hudActive" have to be true. "hornObject" is a good indicator to check if the player piloting the cyclops.
                if ((bool)cyclops_HUD.ReflectionGet("hudActive"))
                {
                    __state = cyclops_HUD.hornObject.activeSelf;
                    return(cyclops_HUD.hornObject.activeSelf);
                }
            }
            __state = false;
            return(false);
        }
        internal void FastUpdate(CyclopsHelmHUDManager cyclopsHelmHUD, int lastPowerInt)
        {
            if (!cyclopsHelmHUD.LOD.IsFull() || Player.main.currentSub != Cyclops)
            {
                return; // Same early exit
            }
            if (totalPowerInfoIcons > 0)
            {
                if (!powerIconsInitialized)
                {
                    AddPowerIcons(cyclopsHelmHUD);
                }
                else
                {
                    UpdatePowerIcons();
                }
            }

            if (lastPowerInt < 0f)
            {
                return;
            }

            PowerRelay powerRelay = Cyclops.powerRelay;

            switch (lastDisplay = settings.EnergyDisplay)
            {
            case HelmEnergyDisplay.PowerCellAmount:
                cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower());
                break;

            case HelmEnergyDisplay.PercentageOverPowerCells:
                float percentOver = (powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower()) / powerRelay.GetMaxPower();
                cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percentOver * 100f)}%";
                break;

            case HelmEnergyDisplay.CombinedAmount:
                cyclopsHelmHUD.powerText.text = NumberFormatter.FormatValue(powerRelay.GetPower() + this.ChargeManager.GetTotalReservePower());
                break;

            default:     // HelmEnergyDisplay.PowerCellPercentage:
                float percent = powerRelay.GetPower() / powerRelay.GetMaxPower();
                cyclopsHelmHUD.powerText.text = $"{NumberFormatter.FormatValue(percent * 100f)}%";
                break;
            }
        }
        public static void Postfix(ref CyclopsHelmHUDManager __instance)
        {
            if (!__instance.LOD.IsFull() ||         // can't see
                !__instance.subLiveMixin.IsAlive()) // dead
            {
                return;
            }

            PowerManager powerMgr = CyclopsManager.GetPowerManager(__instance.subRoot);

            if (powerMgr == null)
            {
                return;
            }

            powerMgr.UpdateHelmHUD(__instance, ref lastReservePower);
        }
Пример #15
0
 public static void Postfix(CyclopsHelmHUDManager __instance)
 {
     __instance.ReflectionSet("hudActive", true);
 }
 public static void Postfix(CyclopsHelmHUDManager __instance)
 {
     __instance.hudActive = true;
     __instance.engineToggleAnimator.SetTrigger(__instance.motorMode.engineOn ? "EngineOn" : "EngineOff");
 }
Пример #17
0
 public static void Prefix(CyclopsHelmHUDManager __instance)
 {
     __instance.fireWarning           = false;
     __instance.creatureAttackWarning = false;
     __instance.hullDamageWarning     = false;
 }
Пример #18
0
 public static void Postfix(ref CyclopsHelmHUDManager __instance, ref int __state)
 {
     CyclopsManager.GetManager(__instance.subRoot)?.HUD.FastUpdate(__instance, __state);
 }
Пример #19
0
        private void AddPowerIcons(CyclopsHelmHUDManager cyclopsHelmHUD)
        {
            cyclopsHelmHUD.powerText.resizeTextForBestFit = true;

            QuickLogger.Debug($"CyclopsHUDManager Adding Power Info Icons for '{totalPowerInfoIcons}' CyclopsChargers");
            holographicHUD = cyclopsHelmHUD.subRoot.GetComponentInChildren <CyclopsHolographicHUD>();

            Canvas pilotingCanvas = cyclopsHelmHUD.powerText.canvas;
            Canvas holoCanvas     = holographicHUD.healthBar.canvas;

            const float spacingUnit = 35;
            const float helmzoffset = 0.05f;
            const float helmyoffset = -225;
            const float helmscale   = 1.35f;

            const float healthbarxoffset   = 120f;
            const float thermometerxoffset = healthbarxoffset * 1.96f;
            const float healthbarzoffset   = 0.05f;
            const float healthbaryoffset   = -300f;
            const float healthbarscale     = 0.65f;
            const float thermometerscale   = healthbarscale * 1.25f;

            /* --- 3-1-2 --- */
            /* ---- 1-2 ---- */

            if (totalPowerInfoIcons == 1)
            {
                HelmIndicatorsOdd       = new PowerIndicatorIcon[1];
                HelmIndicatorsEven      = new PowerIndicatorIcon[0];
                HealthBarIndicatorsOdd  = new PowerIndicatorIcon[1];
                HealthBarIndicatorsEven = new PowerIndicatorIcon[0];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);
            }
            else
            {
                int totalIcons = totalPowerInfoIcons;

                if (totalIcons % 2 != 0)
                {
                    totalIcons--;
                }

                HelmIndicatorsOdd       = new PowerIndicatorIcon[totalIcons + 1];
                HelmIndicatorsEven      = new PowerIndicatorIcon[totalIcons];
                HealthBarIndicatorsOdd  = new PowerIndicatorIcon[totalIcons + 1];
                HealthBarIndicatorsEven = new PowerIndicatorIcon[totalIcons];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);

                int   index           = 0;
                float healtBarSpacing = 0f;
                float helmSpacing     = 0f;
                do
                {
                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add even icons first
                    HelmIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add odd icons next
                    HelmIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    index += 2;
                } while (totalIcons > index);
            }

            TemperatureReadout             = IconCreator.CreatePowerIndicatorIcon(holoCanvas, thermometerxoffset, -2.5f, healthbarzoffset, thermometerscale);
            TemperatureReadout.Icon.sprite = CyclopsThermometer ?? SpriteManager.Get(TechType.CyclopsThermalReactorModule);

            powerIconsInitialized = true;

            QuickLogger.Debug("Linked CyclopsHUDManager to HelmHUD");
        }
 public static void QuickUpdate(CyclopsHelmHUDManager hudManager)
 {
     CyclopsManager.GetManager(ref hudManager.subRoot)?.HUD?.FastUpdate(hudManager);
 }
        private void AddStatusIcons(CyclopsHelmHUDManager cyclopsHelmHUD)
        {
            TooLateToRegister = true;
            for (int i = 0; i < StatusIconCreators.Count; i++)
            {
                StatusIconCreator creator = StatusIconCreators[i];

                QuickLogger.Debug($"CyclopsHUDManager creating standalone status icon '{creator.StatusIconName}'");
                CyclopsStatusIcon statusIcon = creator.Creator.Invoke(Cyclops);

                if (statusIcon == null)
                {
                    QuickLogger.Warning($"CyclopsHUDManager '{creator.StatusIconName}' was null");
                }
                else
                {
                    StatusIcons.Add(statusIcon);
                    QuickLogger.Debug($"Created CyclopsStatusIcon '{creator.StatusIconName}'");
                }
            }

            int totalPowerInfoIcons = Math.Max(StatusIcons.Count, 1); // Include a minimum of 1 for the vanilla thermal charger

            cyclopsHelmHUD.powerText.resizeTextForBestFit = true;

            QuickLogger.Debug($"CyclopsHUDManager Adding '{totalPowerInfoIcons}' Status Info Icons");
            holographicHUD = cyclopsHelmHUD.subRoot.GetComponentInChildren <CyclopsHolographicHUD>();

            Canvas pilotingCanvas = cyclopsHelmHUD.powerText.canvas;
            Canvas holoCanvas     = holographicHUD.healthBar.canvas;

            const float spacingUnit = 35;
            const float helmzoffset = 0.05f;
            const float helmyoffset = -225;
            const float helmscale   = 1.35f;

            const float healthbarxoffset   = 120f;
            const float thermometerxoffset = healthbarxoffset * 1.96f;
            const float healthbarzoffset   = 0.05f;
            const float healthbaryoffset   = -300f;
            const float healthbarscale     = 0.65f;
            const float thermometerscale   = healthbarscale * 1.25f;

            /* --- 3-1-2 --- */
            /* ---- 1-2 ---- */

            if (totalPowerInfoIcons == 1)
            {
                HelmIndicatorsOdd       = new IndicatorIcon[1];
                HelmIndicatorsEven      = new IndicatorIcon[0];
                HealthBarIndicatorsOdd  = new IndicatorIcon[1];
                HealthBarIndicatorsEven = new IndicatorIcon[0];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);
            }
            else
            {
                int totalIcons = totalPowerInfoIcons;

                if (totalIcons % 2 != 0)
                {
                    totalIcons--;
                }

                HelmIndicatorsOdd       = new IndicatorIcon[totalIcons + 1];
                HelmIndicatorsEven      = new IndicatorIcon[totalIcons];
                HealthBarIndicatorsOdd  = new IndicatorIcon[totalIcons + 1];
                HealthBarIndicatorsEven = new IndicatorIcon[totalIcons];

                HelmIndicatorsOdd[0]      = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);

                int   index           = 0;
                float healtBarSpacing = 0f;
                float helmSpacing     = 0f;
                do
                {
                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add even icons first
                    HelmIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsEven[index + 0] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsEven[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add odd icons next
                    HelmIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsOdd[index + 1] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsOdd[index + 2] = IconCreator.CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    index += 2;
                } while (totalIcons > index);
            }

            TemperatureReadout             = IconCreator.CreatePowerIndicatorIcon(holoCanvas, thermometerxoffset, -2.5f, healthbarzoffset, thermometerscale);
            TemperatureReadout.Icon.sprite = CyclopsThermometer ?? SpriteManager.Get(TechType.CyclopsThermalReactorModule);

            powerIconsInitialized = true;

            QuickLogger.Debug("Linked CyclopsHUDManager to HelmHUD");
        }
        private void AddPowerIcons(CyclopsHelmHUDManager cyclopsHelmHUD)
        {
            cyclopsHelmHUD.powerText.resizeTextForBestFit = true;

            if (totalPowerInfoIcons == 0)
            {
                QuickLogger.Debug($"CyclopsHUDManager 0 Power Info Icons required");
                return;
            }

            QuickLogger.Debug($"CyclopsHUDManager Adding Power Info Icons for '{totalPowerInfoIcons}' CyclopsChargers");
            holographicHUD = cyclopsHelmHUD.subRoot.GetComponentInChildren <CyclopsHolographicHUD>();

            Canvas pilotingCanvas = cyclopsHelmHUD.powerText.canvas;
            Canvas holoCanvas     = holographicHUD.healthBar.canvas;

            const float spacingUnit = 35;
            const float helmzoffset = 0.05f;
            const float helmyoffset = -225;
            const float helmscale   = 1.35f;

            const float healthbarxoffset = 120f;
            const float healthbarzoffset = 0.05f;
            const float healthbaryoffset = -300f;
            const float healthbarscale   = 0.65f;

            /* --- 3-1-2 --- */
            /* ---- 1-2 ---- */

            if (totalPowerInfoIcons == 1)
            {
                HelmIndicatorsOdd       = new Indicator[1];
                HelmIndicatorsEven      = new Indicator[0];
                HealthBarIndicatorsOdd  = new Indicator[1];
                HealthBarIndicatorsEven = new Indicator[0];

                HelmIndicatorsOdd[0]      = CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);
            }
            else
            {
                int totalIcons = totalPowerInfoIcons;

                if (totalIcons % 2 != 0)
                {
                    totalIcons--;
                }

                HelmIndicatorsOdd       = new Indicator[totalIcons + 1];
                HelmIndicatorsEven      = new Indicator[totalIcons];
                HealthBarIndicatorsOdd  = new Indicator[totalIcons + 1];
                HealthBarIndicatorsEven = new Indicator[totalIcons];

                HelmIndicatorsOdd[0]      = CreatePowerIndicatorIcon(pilotingCanvas, 0, helmyoffset, helmzoffset, helmscale);
                HealthBarIndicatorsOdd[0] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + 0, healthbaryoffset, healthbarzoffset, healthbarscale);

                int   index           = 0;
                float healtBarSpacing = 0f;
                float helmSpacing     = 0f;
                do
                {
                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add even icons first
                    HelmIndicatorsEven[index + 0] = CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsEven[index + 1] = CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsEven[index + 0] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsEven[index + 1] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    healtBarSpacing += spacingUnit;
                    helmSpacing     += spacingUnit * 2f;

                    // Add odd icons next
                    HelmIndicatorsOdd[index + 1] = CreatePowerIndicatorIcon(pilotingCanvas, -helmSpacing, helmyoffset, helmzoffset, helmscale);
                    HelmIndicatorsOdd[index + 2] = CreatePowerIndicatorIcon(pilotingCanvas, helmSpacing, helmyoffset, helmzoffset, helmscale);

                    HealthBarIndicatorsOdd[index + 1] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + -healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);
                    HealthBarIndicatorsOdd[index + 2] = CreatePowerIndicatorIcon(holoCanvas, healthbarxoffset + healtBarSpacing, healthbaryoffset, healthbarzoffset, healthbarscale);

                    index += 2;
                } while (totalIcons > index);
            }

            powerIconsInitialized = true;

            QuickLogger.Debug("Linked CyclopsHUDManager to HelmHUD");
        }
 internal static bool Prefix(CyclopsHelmHUDManager __instance)
 {
     // Ensure that the alert only plays when in Flank mode
     return(__instance.motorMode.cyclopsMotorMode == CyclopsMotorMode.CyclopsMotorModes.Flank);
 }
 public static void Postfix(CyclopsHelmHUDManager __instance)
 {
     __instance.hudActive = true;
 }