/// <summary> /// 特定的资源一次单位生产所需要的时间 /// </summary> /// <returns>The wheat number.</returns> /// <param name="relation">Relation.</param> static int getBeedSecond(ResourceType type) { ResourceRelationshipData relation = WorkshopModel.Relationships.Find(item => item.Type == type); if (relation == null) { return(0); } if (relation.Needs.Count == 0) { return((int)Mathf.Clamp(relation.YieldNum * (int)modifyResourceTimeout, modifyResourceTimeout, 36000000)); } int needNum = 0; for (int i = 0; i < relation.Needs.Count; i++) { needNum += (int)Mathf.Clamp(getBeedSecond(relation.Needs[i].Type) * (int)relation.Needs[i].Num + (int)modifyResourceTimeout, modifyResourceTimeout, 36000000); } return((int)Mathf.Clamp(needNum, modifyResourceTimeout, 36000000)); }
/// <summary> /// 特定的资源一次单位生产所需要的小麦基础资源数 /// </summary> /// <returns>The wheat number.</returns> /// <param name="relation">Relation.</param> static int getNeedWheatNum(ResourceType type) { ResourceRelationshipData relation = WorkshopModel.Relationships.Find(item => item.Type == type); if (relation == null) { return(0); } if (relation.Needs.Count == 0) { return(relation.YieldNum); } int needNum = 0; for (int i = 0; i < relation.Needs.Count; i++) { needNum += (getNeedWheatNum(relation.Needs[i].Type) * (int)relation.Needs[i].Num); } return(needNum); }