Пример #1
0
        private static MechComponent FindAndCritComponent(AIMCritInfo critInfo, float random)
        {
            MechComponent component = critInfo.FindComponentFromRoll(random);

            if (component != null)
            {
                if (DebugLog)
                {
                    Verbo("Play crit SFX and VFX on {0} ({1}) at {2}", component, component.DamageLevel, component.Location);
                }
                PlaySFX(critInfo);
                PlayVFX(critInfo);
                AttackDirector.AttackSequence attackSequence = GetAttackSequence(critInfo.hitInfo);
                attackSequence?.FlagAttackScoredCrit(component as Weapon, component as AmmunitionBox);
                ComponentDamageLevel newDamageLevel = GetDegradedComponentLevel(critInfo);
                if (DebugLog)
                {
                    Verbo("Component damaged to {0}", newDamageLevel);
                }
                try {
                    component.DamageComponent(critInfo.hitInfo, newDamageLevel, true);
                } catch (Exception ex) { Error(ex); }
            }
            return(component);
        }