public ResearchFieldData(ResearchField field, ResearchPool pool) { if (field == null) { throw new ArgumentNullException("field"); } if (pool == null) { throw new ArgumentNullException("pool"); } _field = field; _pool = pool; }
/// <summary> /// Index operator to allow array type indexing to a TechLevel. /// </summary> /// <param name="index">A TechLevel.ResearchField.</param> /// <returns>The current tech level.</returns> public int this[ResearchField index] { get { if (this.techValues == null) { throw new System.NullReferenceException("TechLevel.cs : index operator - attempt to index with no TechValues defined."); } int techLevel = 0; // default tech level switch (index) { case ResearchField.Biotechnology: techLevel = techValues["Biotechnology"]; break; case ResearchField.Construction: techLevel = techValues["Construction"]; break; case ResearchField.Electronics: techLevel = techValues["Electronics"]; break; case ResearchField.Energy: techLevel = techValues["Energy"]; break; case ResearchField.Propulsion: techLevel = techValues["Propulsion"]; break; case ResearchField.Weapons: techLevel = techValues["Weapons"]; break; default: throw new System.ArgumentException("TechLevel.cs: indexing operator - Unknown field of research", index.ToString()); } return(techLevel); } set { switch (index) { case ResearchField.Biotechnology: this.techValues["Biotechnology"] = value; break; case ResearchField.Construction: this.techValues["Construction"] = value; break; case ResearchField.Electronics: this.techValues["Electronics"] = value; break; case ResearchField.Energy: this.techValues["Energy"] = value; break; case ResearchField.Propulsion: this.techValues["Propulsion"] = value; break; case ResearchField.Weapons: this.techValues["Weapons"] = value; break; default: throw new System.ArgumentException("TechLevel.cs: indexing operator - Unknown field of research", index.ToString()); } } }