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); }
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); }
protected override bool CanFireNowSub(IncidentParms parms) { Map map = (Map)parms.target; return(ShortCircuitUtility.GetShortCircuitablePowerConduits(map).Any()); }
protected override bool CanFireNowSub(IIncidentTarget target) { Map map = (Map)target; return(ShortCircuitUtility.GetShortCircuitablePowerConduits(map).Any <Building>()); }