protected override bool TryExecuteWorker(IncidentParms parms)
 {
     if (!ShortCircuitUtility.GetShortCircuitablePowerConduits((Map)parms.target).TryRandomElement(out var result))
     {
         return(false);
     }
     ShortCircuitUtility.DoShortCircuit(result);
     return(true);
 }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;
            IEnumerable <Building> shortCircuitablePowerConduits = ShortCircuitUtility.GetShortCircuitablePowerConduits(map);

            if (!shortCircuitablePowerConduits.TryRandomElement(out Building result))
            {
                return(false);
            }
            ShortCircuitUtility.DoShortCircuit(result);
            return(true);
        }
Example #3
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;
            IEnumerable <Building> shortCircuitablePowerConduits = ShortCircuitUtility.GetShortCircuitablePowerConduits(map);
            Building culprit;
            bool     result;

            if (!shortCircuitablePowerConduits.TryRandomElement(out culprit))
            {
                result = false;
            }
            else
            {
                ShortCircuitUtility.DoShortCircuit(culprit);
                result = true;
            }
            return(result);
        }