Exemple #1
0
        private void SetIsTargetObjective(ICombatant combatant)
        {
            Main.LogDebug($"[SetUnitsInRegionToBeTaggedObjectiveTargetsResult] Setting isObjectiveTarget '{IsObjectiveTarget}' for '{combatant.GameRep.name} - {combatant.DisplayName}'");
            ObstructionGameLogic obstructionGameLogic = combatant.GameRep.GetComponent <ObstructionGameLogic>();

            obstructionGameLogic.isObjectiveTarget = true;

            if (Type == "Building")
            {
                BattleTech.Building building = combatant as BattleTech.Building;
                AccessTools.Field(typeof(BattleTech.Building), "isObjectiveTarget").SetValue(building, true);
                building.BuildingRep.IsTargetable = true;
            }

            CombatHUDInWorldElementMgr inworldElementManager = GameObject.Find("uixPrfPanl_HUD(Clone)").GetComponent <CombatHUDInWorldElementMgr>();

            AccessTools.Method(typeof(CombatHUDInWorldElementMgr), "AddTickMark").Invoke(inworldElementManager, new object[] { combatant });
            AccessTools.Method(typeof(CombatHUDInWorldElementMgr), "AddInWorldActorElements").Invoke(inworldElementManager, new object[] { combatant });

            if (Type == "Building")
            {
                CombatHUDNumFlagHex        numFlagEx = inworldElementManager.GetNumFlagForCombatant(combatant);
                CombatHUDFloatieStackActor floatie   = inworldElementManager.GetFloatieStackForCombatant(combatant);

                numFlagEx.anchorPosition = CombatHUDInWorldScalingActorInfo.AnchorPosition.Feet;
                floatie.anchorPosition   = CombatHUDInWorldScalingActorInfo.AnchorPosition.Feet;
            }
        }
Exemple #2
0
        public static void ForceNameRefresh(CombatGameState combat)
        {
            CombatHUD combatHUD = VisRangeIndicator.Instance.HUD;
            CombatHUDInWorldElementMgr inWorldMgr = combatHUD?.InWorldMgr;

            if (combat == null || combatHUD == null || inWorldMgr == null)
            {
                Mod.Log.Warn?.Write("CombatGameState, CombatHUD, or InWorldManager was null when a ForceNameRefresh call was made - skipping!");
                return;
            }

            // Force an update of visibility state to try to get the mech labels to update
            foreach (ICombatant combatant in combat.GetAllImporantCombatants())
            {
                CombatHUDNumFlagHex flagHex = inWorldMgr.GetNumFlagForCombatant(combatant);
                // Can be null in CWolf's blackout contracts. He intentionally disables the flagHex in those cases.
                if (flagHex != null)
                {
                    flagHex.ActorInfo.NameDisplay.RefreshInfo();
                }
            }
        }