private void FixedUpdate() { if (pressure > maxPressureThreshold ^ pressure < minPressureThreshold) { //any damage function setHP(HP - 1); } if (temperature > maxTemperatureThreshold ^ temperature < minTemperatureThreshold) { //any damage function setHP(HP - 1); } /* * //toggle radiation DPS * if (Input.GetKey("r")) * { * setRadiation(radiation + 1); * } */ //Temperature setting setTemperature(BiomeManager.getBiomeAt((int)GameObject.FindGameObjectWithTag("Player").transform.position.x).getTemperature((int)GameObject.FindGameObjectWithTag("Player").transform.position.y)); setPressure(BiomeManager.getBiomeAt((int)GameObject.FindGameObjectWithTag("Player").transform.position.x).getPressure((int)GameObject.FindGameObjectWithTag("Player").transform.position.y)); }
public static void generateNearbyUnloadedChunks() { Vector3 pos = GameObject.FindGameObjectWithTag("Player").transform.position; int drillX = (int)pos.x; int drillY = (int)pos.y; for (int possibleX = 0; possibleX < drillX + sightHalfWidth * 2; possibleX += chunkSize) { for (int possibleY = 0; possibleY > drillY - sightHalfHeight * 2; possibleY -= chunkSize) { Coordinate c = new Coordinate(possibleX, possibleY); if (c.isWithinSight(pos, sightHalfWidth, sightHalfHeight, chunkSize)) { if (c.isInArray(loadedChunkCoordinates)) { continue; } loadedChunkCoordinates.Add(c); BiomeManager.getBiomeAt(possibleX).actuallyGenerateChunk(c); return; } } } }