Exemple #1
0
        public static void ResolveComponent(Design design)
        {
            foreach (HitLocation location in design.HitLocations)
            {
                BattleMechHitLocation bmhl  = location as BattleMechHitLocation;
                List <CriticalSlot>   slots = new List <CriticalSlot>();

                List <ComponentTargetingComputer> computers = ComponentTargetingComputer.GetCanonicalTargetingComputers();
                foreach (ComponentTargetingComputer componentTargetingComputer in computers)
                {
                    if (design.IsCompatible(componentTargetingComputer))
                    {
                        componentTargetingComputer.Configure(design);

                        foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots)
                        {
                            if (Utilities.IsSynonymFor(componentTargetingComputer, criticalSlot.Label))
                            {
                                slots.Add(criticalSlot);
                            }
                        }


                        if (slots.Count == (int)(Math.Ceiling(componentTargetingComputer.Tonnage)))
                        {
                            UnitComponent uc = new UnitComponent(componentTargetingComputer, bmhl);
                            design.Components.Add(uc);
                        }
                    }
                }
            }
        }
        public override object Clone()
        {
            ComponentTargetingComputer retval = base.Clone() as ComponentTargetingComputer;

            return(retval);
        }