예제 #1
0
 static public bool LocationHasCASE(BattleMechHitLocation hitLocation)
 {
     foreach (CriticalSlot slot in hitLocation.CriticalSlots)
     {
         if (slot.AffectedComponent != null)
         {
             ComponentCASE caseComponent = slot.AffectedComponent.Component as ComponentCASE;
             if (caseComponent != null)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #2
0
        public static void ResolveComponent(Design design)
        {
            List <ComponentCASE> caseComponents = ComponentCASE.GetCanonicalCASE();

            foreach (HitLocation location in design.HitLocations)
            {
                BattleMechHitLocation bmhl = location as BattleMechHitLocation;
                Dictionary <ComponentCASE, List <CriticalSlot> > dicComponents = new Dictionary <ComponentCASE, List <CriticalSlot> >();
                foreach (ComponentCASE component in caseComponents)
                {
                    dicComponents.Add(component, new List <CriticalSlot>());
                }

                foreach (CriticalSlot criticalSlot in bmhl.CriticalSlots)
                {
                    foreach (ComponentCASE sKey in dicComponents.Keys)
                    {
                        if (Utilities.IsSynonymFor(sKey, criticalSlot.Label))
                        {
                            dicComponents[sKey].Add(criticalSlot);
                        }
                    }
                }

                foreach (ComponentCASE component in dicComponents.Keys)
                {
                    if (dicComponents[component].Count == component.CriticalSpaceMech)
                    {
                        //Add component to design
                        UnitComponent uc = new UnitComponent(component.Clone() as Component, location);
                        foreach (CriticalSlot criticalSlot in dicComponents[component])
                        {
                            criticalSlot.AffectedComponent = uc;
                        }
                        design.Components.Add(uc);
                    }
                }
            }
        }
예제 #3
0
        public override object Clone()
        {
            ComponentCASE retval = base.Clone() as ComponentCASE;

            return(retval);
        }