public Planet Create() { var isHabitable = randomGenerator.GenerateBool(probHabitable); var area = randomGenerator.GenerateDouble(minArea, maxArea); return(new Planet(positionFactory.Create(), isHabitable, area)); }
public Monster Create() { return(new Monster(positionFactory.Create())); }
public override IPosition Create() { return(_factory.Create(_requirements)); }
/// <summary> /// Sets positions /// </summary> protected void SetPositions() { positions.Clear(); if (measures.Count < 3) { return; } measuresData.Clear(); IDataConsumer c = this; foreach (string ms in measures) { for (int i = 0; i < c.Count; i++) { IMeasurements m = c[i]; IAssociatedObject ao = m as IAssociatedObject; string on = this.GetRelativeName(ao) + "."; for (int j = 0; j < m.Count; j++) { IMeasurement mea = m[j]; string s = on + mea.Name; if (s.Equals(ms)) { measuresData.Add(mea); } } } } List <IIterator> iterators = new List <IIterator>(); c.GetIterators(iterators); foreach (IIterator it in iterators) { it.Reset(); } IDataConsumer consumer = this; IDataRuntime rt = consumer.CreateRuntime(StaticExtensionDataPerformerInterfaces.Calculation); while (true) { rt.UpdateAll(); object[] ob = new object[measuresData.Count]; for (int i = 0; i < measuresData.Count; i++) { object o = measuresData[i].Parameter(); if (o is DBNull | o == null) { goto iterate; } ob[i] = o; } IPosition position = factory.Create(ob); if (position != null) { positions.Add(position); } iterate: foreach (IIterator it in iterators) { if (!it.Next()) { goto fin; } } } fin: Parent = parent; return; }