Ejemplo n.º 1
0
        private void SetTeam(ICombatant combatant)
        {
            Main.LogDebug($"[SetUnitsInRegionToBeTaggedObjectiveTargetsResult] Setting Team '{Team}' for '{combatant.GameRep.name} - {combatant.DisplayName}'");
            Team oldTeam = combatant.team;
            Team newTeam = UnityGameInstance.BattleTechGame.Combat.ItemRegistry.GetItemByGUID <Team>(TeamUtils.GetTeamGuid(Team));

            if (Type == "Building")
            {
                oldTeam.RemoveBuilding((BattleTech.Building)combatant);
                newTeam.AddCombatant(combatant);
            }
            else
            {
                Main.LogDebug($"[SetUnitsInRegionToBeTaggedObjectiveTargetsResult] Setting Team '{Type}' Not Yet Supported. Use 'SetTeamByLanceSpawnerGuid'");
            }

            /*
             * // Dumped this here for a visibility test after OnEncounterBegin
             * Main.LogDebug($"[SetUnitsInRegionToBeTaggedObjectiveTargetsResult] Units in team are: '{newTeam.units.Count}'");
             * newTeam.units.ForEach(unit => {
             * Main.LogDebug($"[SetUnitsInRegionToBeTaggedObjectiveTargetsResult] Hiding unit '{unit.DisplayName}'");
             * unit.OnPlayerVisibilityChanged(VisibilityLevel.None);
             * });
             *
             * List<ICombatant> allLivingCombatants = UnityGameInstance.BattleTechGame.Combat.GetAllLivingCombatants();
             * AccessTools.Method(typeof(TurnDirector), "RebuildVisCaches").Invoke(UnityGameInstance.BattleTechGame.Combat.TurnDirector, new object[] { allLivingCombatants });
             */
        }