public void setTile(GridTile til) { tile = til; WindController.GetWindAtTile(til, 0); biome.text = biomes[Mathf.FloorToInt(tile.biome)]; if (true /*tile.occupant == null*/) { occupant.text = "None"; } //else //{ // if (tile.occupant.obj.name.Equals("RockEmpty(Clone)") || tile.occupant.obj.name.Equals("StoneCubeEmpty(Clone)")) // { // occupant.text = "A rock"; // } else if (tile.occupant.obj.name.Equals("House Colored")) // { // occupant.text = "A house"; // } else if(tile.occupant.obj.name.Equals("NewTreeEmpty(Clone)")) // { // occupant.text = "A tree"; // } else if (tile.occupant.obj.name.Equals("CactusEmpty(Clone)")) // { // occupant.text = "A cactus"; // } // else // { // occupant.text = "Wind Turbine"; // } //} //position.text = tile.position.ToString("F0"); }
float CpDesign() { float V_rated = uniProperties.ratedCutoffProperty.minPropertyValue; float V_cutoff = uniProperties.ratedCutoffProperty.maxPropertyValue; float height = uniProperties.heightProperty.propertyValue; float V = WindController.GetWindAtTile(onGridtile, height); if (V < Vcutin) { return(0); } else if (Vcutin < V && V <= V_rated) { return(CpReference()); } else if (V_rated < V && V <= V_cutoff) { return(CpFormula(V, V_rated, V_cutoff)); } else { return(0); } }
void CalculateChunk(object args) { object[] argsArr = (object[])args; int i = (int)argsArr[0]; float time = (float)argsArr[1]; int operationsPerThread = Mathf.CeilToInt(windSpeedChunks.Count / chunkThreads.Length); int windCount = windSpeedChunks.Count; int startK = (int)i * operationsPerThread; int endK = ((int)i + 1) * operationsPerThread; for (int k = startK; k < endK; k++) { if (k >= windCount) { break; } if (!windSpeedChunks[k].isEnabled) { continue; } List <Vector3> vert = threadVerts[k]; for (int j = 0; j < vert.Count; j++) { GridTile tile = GridTile.FindClosestGridTile(vert[j]); if (tile != null && tile.canSeeWind && !tile.isOutsideBorder) { float curWind = WindController.GetWindAtTile(tile, height, time); Vector2 curUv = new Vector2(1 - curWind / WindController.WindMagnitudeAtTime(time), 1 - curWind / WindController.WindMagnitudeAtTime(time)); for (int intp = 0; intp < intpSteps; intp++) { if (curUvs) { Vector2 interpolated = Vector2.Lerp(buffereduvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1)); uvs[k][intp][j].Set(interpolated.x, interpolated.y); } else { Vector2 interpolated = Vector2.Lerp(uvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1)); buffereduvs[k][intp][j].Set(interpolated.x, interpolated.y); } if (stopThreads) { return; } } } else if (tile != null && !tile.canSeeWind && !tile.isOutsideBorder) { Vector2 curUv = new Vector2(0.125f, 0.875f); for (int intp = 0; intp < intpSteps; intp++) { if (curUvs) { Vector2 interpolated = Vector2.Lerp(buffereduvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1)); uvs[k][intp][j].Set(interpolated.x, interpolated.y); } else { Vector2 interpolated = Vector2.Lerp(uvs[k][(intpSteps - 1)][j], curUv, (float)intp / (intpSteps - 1)); buffereduvs[k][intp][j].Set(interpolated.x, interpolated.y); } if (stopThreads) { return; } } } } } }
void UpdatePower(float gameDeltaTime) { cp = Cp(); power = 0.5f * Cp() * 1.225f * uniProperties.areaProperty.propertyValue * Mathf.Pow(WindController.GetWindAtTile(onGridtile, uniProperties.heightProperty.propertyValue), 3); //print(WindController.GetWindAtTile(onGridtile, uniProperties.heightProperty.propertyValue)); }