private void CreateNoises(out INoise mainLandscape, out INoise underground, out INoise landScapeType, out INoise temperature, out INoise moisture, out INoise zones) { INoise terrainDelimiter; switch (_config.ProcessorParam.WorldType) { case enuWorldType.Island: terrainDelimiter = new Cache <INoise>(new IslandCtrl(_worldParameters.Seed + 1233, _config.ProcessorParam.IslandCtrlSize).GetLandFormFct()); break; case enuWorldType.Normal: default: terrainDelimiter = new Cache <INoise>(new WorldCtrl(_worldParameters.Seed + 1698, _config.ProcessorParam.WorldCtrlOctave, _config.ProcessorParam.WorldCtrlFrequency).GetLandFormFct()); break; } //Normal Landscape creation //A gradiant is created here, on the Z component, adjusted around 0.45 Gradient mainGradiant = new Gradient(0, 0, 0.45, 0); mainLandscape = new Cache <INoise>(CreateLandFormFct(mainGradiant, terrainDelimiter, out landScapeType)); //Activate it in order to test single landscape configuration //mainLandscape = new Cache<INoise>(FonctionTesting(new Gradient(0, 0, 0.45, 0), terrainDelimiter, out landScapeType)); underground = new UnderGround(_worldParameters.Seed + 999, mainLandscape, terrainDelimiter).GetLandFormFct(); temperature = new Temperature(_worldParameters.Seed - 963, _config.ProcessorParam.TempCtrlOctave, _config.ProcessorParam.TempCtrlFrequency).GetLandFormFct(); moisture = new Moisture(_worldParameters.Seed - 96, _config.ProcessorParam.MoistureCtrlOctave, _config.ProcessorParam.MoistureCtrlFrequency).GetLandFormFct(); zones = new VoronoiZones(_worldParameters.Seed + 16, _config.ProcessorParam.ZoneCtrlFrequency).GetLandFormFct(); }
public void Post([FromBody] Moisture model) { model.Id = Guid.NewGuid(); model.MeasuredAt = DateTime.UtcNow; this.DB.Moisture.Add(model); this.DB.SaveChanges(); }
/// <summary> /// Testing method for Moisture module (function never returns) /// </summary> static void TestMoisture() { Moisture mois = new Moisture(FEZRaptor.Socket2.Pin6, FEZRaptor.Socket2.AnalogInput3); while (true) { var nilai = mois.ReadMoisture(); Debug.WriteLine($"value : {nilai}"); Thread.Sleep(200); } }
public MeasurementService( Moisture moistureSensor, LightSense lightSensor, IInternetOfThingsService internetOfThingsService) { _moistureSensor = moistureSensor; _lightSensor = lightSensor; _internetOfThingsService = internetOfThingsService; // Measure every second. _measurementsTimer = new Timer(new TimeSpan(0, 0, 0, 1)); _measurementsTimer.Tick += measurementsTimer_Tick; _measurementsTimer.Start(); }
public float getMoistureStatus(Moisture moisture) { switch (moisture) { case Moisture.low: return(0.9f); case Moisture.medium: return(1f); case Moisture.high: return(1.1f); default: return(1); } }
public void SetProperties() { var sunExposures = SunExposure.Split(','); var moistures = Moisture.Split(','); foreach (string s in sunExposures) { if (s == "P" || s == " P" || s == "P " || s == " P ") { this.Prairie = 1; } if (s == "S" || s == " S" || s == "S " || s == " S ") { this.Savanna = 1; } if (s == "W" || s == " W" || s == "W " || s == " W ") { this.Woodland = 1; } } foreach (string s in moistures) { if (s == "D" || s == " D" || s == "D " || s == " D ") { this.Drymesic = 1; } if (s == "DM" || s == " DM" || s == "DM " || s == " DM ") { this.Drymesic = 1; } if (s == "M" || s == " M" || s == "M " || s == " M ") { this.Mesic = 1; } if (s == "WM" || s == " WM" || s == "WM " || s == " WM ") { this.Wetmesic = 1; } if (s == "W" || s == " W" || s == "W " || s == " W ") { this.Wet = 1; } } }
public string CheckStatus() { return("Temperature: " + Temperature.ToString() + " Moisture: " + Moisture.ToString() + "\n"); }
public void UpdatePerceptions(RolePlayCharacterAsset rpc) { /* * Find every InSight, InInventory, and IsEquipped belief and set them to false * */ CleanBeliefs(rpc); /* * Update the KB with the new beliefs * */ string bv = rpc.GetBeliefValue("Hunger(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(Hunger.ToString())) { Debug.WriteLine("Hunger: " + bv + " -> " + Hunger.ToString()); rpc.Perceive(EventHelper.PropertyChange("Hunger(" + rpc.CharacterName.ToString() + ")", Hunger.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("Health(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(Health.ToString())) { Debug.WriteLine("Health: " + bv + " -> " + Health.ToString()); rpc.Perceive(EventHelper.PropertyChange("Health(" + rpc.CharacterName.ToString() + ")", Health.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("Sanity(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(Sanity.ToString())) { Debug.WriteLine("Sanity: " + bv + " -> " + Sanity.ToString()); rpc.Perceive(EventHelper.PropertyChange("Sanity(" + rpc.CharacterName.ToString() + ")", Sanity.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("IsFreezing(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(IsFreezing.ToString())) { Debug.WriteLine("IsFreezing: " + bv + " -> " + IsFreezing.ToString()); rpc.Perceive(EventHelper.PropertyChange("IsFreezing(" + rpc.CharacterName.ToString() + ")", IsFreezing.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("IsOverheating(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(IsOverheating.ToString())) { Debug.WriteLine("IsOverheating: " + bv + " -> " + IsOverheating.ToString()); rpc.Perceive(EventHelper.PropertyChange("IsOverheating(" + rpc.CharacterName.ToString() + ")", IsOverheating.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("Moisture(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(Moisture.ToString())) { Debug.WriteLine("Moisture: " + bv + " -> " + Moisture.ToString()); rpc.Perceive(EventHelper.PropertyChange("Moisture(" + rpc.CharacterName.ToString() + ")", Moisture.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("Temperature(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(Temperature.ToString())) { Debug.WriteLine("Temperature: " + bv + " -> " + Temperature.ToString()); rpc.Perceive(EventHelper.PropertyChange("Temperature(" + rpc.CharacterName.ToString() + ")", Temperature.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("IsBusy(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(IsBusy.ToString())) { Debug.WriteLine("IsBusy: " + bv + " -> " + IsBusy.ToString()); rpc.Perceive(EventHelper.PropertyChange("IsBusy(" + rpc.CharacterName.ToString() + ")", IsBusy.ToString(), rpc.CharacterName.ToString())); } bv = rpc.GetBeliefValue("PosX(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(PosX.ToString())) { rpc.Perceive(EventHelper.PropertyChange("PosX(" + rpc.CharacterName.ToString() + ")", PosX.ToString(), rpc.CharacterName.ToString())); } /* * The Y-axis is always equal to zero, no need to save it in the knowledge base * */ //bv = rpc.GetBeliefValue("PosY(" + rpc.CharacterName.ToString() + ")"); //if (bv == null || !bv.Equals(PosY.ToString())) // rpc.Perceive(EventHelper.PropertyChange("PosY(" + rpc.CharacterName.ToString() + ")", PosY.ToString(), rpc.CharacterName.ToString())); bv = rpc.GetBeliefValue("PosZ(" + rpc.CharacterName.ToString() + ")"); if (bv == null || !bv.Equals(PosZ.ToString())) { rpc.Perceive(EventHelper.PropertyChange("PosZ(" + rpc.CharacterName.ToString() + ")", PosZ.ToString(), rpc.CharacterName.ToString())); } foreach (Item i in Vision) { if (i != null) { bv = rpc.GetBeliefValue("InSight(" + i.GUID + ")"); if (bv == null || !bv.Equals("True")) { rpc.Perceive(EventHelper.PropertyChange("InSight(" + i.GUID + ")", "True", rpc.CharacterName.ToString())); } i.UpdatePerception(rpc); } } foreach (Item i in ItemSlots) { if (i != null) { bv = rpc.GetBeliefValue("InInventory(" + i.GUID + ")"); if (bv == null || !bv.Equals("True")) { rpc.Perceive(EventHelper.PropertyChange("InInventory(" + i.GUID + ")", "TRUE", rpc.CharacterName.ToString())); } i.UpdatePerception(rpc); } } foreach (EquippedItems i in EquipSlots) { if (i != null) { bv = rpc.GetBeliefValue("IsEquipped(" + i.GUID + "," + i.Slot + ")"); if (bv == null || !bv.Equals("True")) { rpc.Perceive(EventHelper.PropertyChange("IsEquipped(" + i.GUID + "," + i.Slot + ")", "TRUE", rpc.CharacterName.ToString())); } i.UpdatePerception(rpc); } } rpc.Update(); }
public Map Generate(Vector2 dimensions, int seed, PointSelector.FaceType faceType, IslandShape.FunctionType functionType, float height, AnimationCurve heightMap, int regionCount, int relaxationCount, float radius) { data = new Map(); data.seed = seed; this.height = height; this.heigtMap = heightMap; islandShape = new IslandShape(seed, dimensions.x, dimensions.y, functionType); rectangle = new Rectangle(0, 0, dimensions.x, dimensions.y); if (faceType == PointSelector.FaceType.Hexagon || faceType == PointSelector.FaceType.Square) { relaxationCount = 0; } Polygon polygon = PointSelector.Generate(dimensions, seed, faceType, regionCount, radius); VoronoiBase voronoi = GenerateVoronoi(ref polygon, relaxationCount); Build(polygon, voronoi); ImproveCorners(); // Determine the elevations and water at Voronoi corners. Elevation.AssignCorner(ref data, islandShape, faceType == PointSelector.FaceType.Hexagon || faceType == PointSelector.FaceType.Square); // Determine polygon and corner type: ocean, coast, land. Biomes.AssignOceanCoastAndLand(ref data); // Rescale elevations so that the highest is 1.0, and they're // distributed well. We want lower elevations to be more common // than higher elevations, in proportions approximately matching // concentric rings. That is, the lowest elevation is the // largest ring around the island, and therefore should more // land area than the highest elevation, which is the very // center of a perfectly circular island. List <Graph.Corner> corners = LandCorners(data.corners); Elevation.Redistribute(ref corners); // Assign elevations to non-land corners foreach (var q in data.corners) { if (q.ocean || q.coast) { q.elevation = 0.0f; } } // Polygon elevations are the average of their corners Elevation.AssignPolygon(ref data); // Determine moisture at corners, starting at rivers // and lakes, but not oceans. Then redistribute // moisture to cover the entire range evenly from 0.0 // to 1.0. Then assign polygon moisture as the average // of the corner moisture. Moisture.AssignCorner(ref data); Moisture.Redistribute(ref corners); Moisture.AssignPolygon(ref data); Biomes.AssignBiomes(ref data); return(data); }
public VariablesEnviroment(float pH, float temperature, Moisture moisture) { this.pH = pH; this.temperature = temperature; this.moisture = moisture; }