コード例 #1
0
 protected override bool TryExecuteWorker(IncidentParms parms)
 {
     if (!ShortCircuitUtility.GetShortCircuitablePowerConduits((Map)parms.target).TryRandomElement(out var result))
     {
         return(false);
     }
     ShortCircuitUtility.DoShortCircuit(result);
     return(true);
 }
コード例 #2
0
        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);
        }
コード例 #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);
        }
コード例 #4
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            return(ShortCircuitUtility.GetShortCircuitablePowerConduits(map).Any());
        }
コード例 #5
0
        protected override bool CanFireNowSub(IIncidentTarget target)
        {
            Map map = (Map)target;

            return(ShortCircuitUtility.GetShortCircuitablePowerConduits(map).Any <Building>());
        }