public bool GetReward(BasePart.PartTier tier, out BasePart part) { part = null; if (this.rewards != null && this.rewards.Count > 0) { int num = UnityEngine.Random.Range(0, this.rewards.Count); int num2 = num; do { num++; if (num >= this.rewards.Count) { num = 0; } BasePart.PartType type = (!this.FirstRewardGiven) ? this.firstReward : this.rewards[num]; List <BasePart> customParts = CustomizationManager.GetCustomParts(type, tier, true); if (customParts.Count > 0) { int num3 = UnityEngine.Random.Range(0, customParts.Count); int num4 = num3; do { num3++; if (num3 >= customParts.Count) { num3 = 0; } if (customParts[num3].craftable) { part = customParts[num3]; if (this.FirstRewardGiven) { this.SetRewardGiven(type, true); } else { this.FirstRewardGiven = true; } num = num2; num3 = num4; } }while (num3 != num4); } }while (num != num2); } return(part != null); }
private bool NewPartsInScope() { if (this.scope == null) { return(CustomizationManager.HasNewParts()); } for (int i = 0; i < this.scope.Count; i++) { List <BasePart> customParts = CustomizationManager.GetCustomParts(this.scope[i], false); for (int j = 0; j < customParts.Count; j++) { if (CustomizationManager.IsPartNew(customParts[j])) { return(true); } } } return(false); }