using UnityEngine;

public class Biome {
	public Sprite sprite = null;

	public string name;
	private float altitude;
	private float temperature;
	private float humidity;
	public float habitability;

	public Biome(string name, float altitude, float temperature, float humidity, float habitability) {
		this.name = name;
		this.altitude = normalizeAltitude(altitude);
		this.temperature = normalizeTemperature(temperature);
		this.humidity = normalizeHumidity(humidity);
		this.habitability = habitability;

		sprite = Helper.loadSprite("Assets/Biomes/" + name + ".png");
	}

	public static float normalizeAltitude(float altitude) {
		return (altitude + 5000) / 10000;
	}

	public static float normalizeTemperature(float temperature) {
		return (temperature + 20) / 70;
	}

	public static float normalizeHumidity(float humidity) {
		return humidity / 100;
	}

	public float distance(float altitude, float temperature, float humidity) {
		Vector3 dist = new Vector3();
		dist.x = (this.altitude - altitude);
		dist.y = this.temperature - temperature;
		dist.z = this.humidity - humidity;
		return dist.sqrMagnitude;
	}
}
