private void CheckRESTRICT() { Adaptation.restriction[] restrictions = new Adaptation.restriction[0]; Adaptation.restriction failItem = Adaptation.restriction.COLD; restrictions = critter.GetRestrictions(); bool value = true; foreach (Adaptation.restriction item in restrictions) { bool canSurvive = habitat.MeetsRestrictionRequirements(item); if (canSurvive == false) { value = false; failItem = item; break; } } if (activeRESTRICTWarning == null) { if (!value) { Sprite[] sprt = new Sprite[1]; sprt[0] = sprites[11]; GlobalWarning.subType[] exType = new GlobalWarning.subType[1]; exType[0] = GlobalWarning.subType.NONE; CreateWarning(warningType.RESTRICT, sprt[0], IconController.GetRestrictionIconColor(failItem)); warnControl.AddWarning(habitat, GlobalWarning.warningType.RESTRICT, exType, sprt); } } else { if (value) { RemoveWarning(activeRESTRICTWarning); } } }
//Calculates Critter's restrictions after replacing equippedEvo with testEvo. private List<Adaptation.restriction> CalculateNewRestrictions(Critter critter, Adaptation testEvo, Adaptation equippedEvo) { List<Adaptation.restriction> activeRestrictions = new List<Adaptation.restriction>(critter.GetRestrictionList()); activeRestrictions = critter.GetRestrictionList(); if (equippedEvo != null) { Adaptation.restriction[] equippedRestrictions = new Adaptation.restriction[equippedEvo.restrictions.Count]; equippedEvo.restrictions.CopyTo(equippedRestrictions); foreach (Adaptation.restriction item in equippedRestrictions) { if (activeRestrictions.Contains(item)) { activeRestrictions.Remove(item); } } } if (testEvo != null) { Adaptation.restriction[] newEvoRestrictions = new Adaptation.restriction[testEvo.restrictions.Count]; testEvo.restrictions.CopyTo(newEvoRestrictions); foreach (Adaptation.restriction item in newEvoRestrictions) { activeRestrictions.Add(item); } } return activeRestrictions; }