Esempio n. 1
0
    public Tile(World world, int x, int y, float height, float temp, float humidity)
    {
        this.world    = world;
        this.x        = x;
        this.y        = y;
        position      = new Vector2Int(x, y);
        this.height   = height;
        this.temp     = temp;
        this.humidity = humidity;

        climate = Climate.GetClimate(height, temp, humidity);
        if (climate == null)
        {
            Debug.LogError($"Can't find matching climate for tile (height: {height:F3}, temp: {temp:F3}, humidity: {humidity:F3})");
            throw new ArgumentException();
        }

        color         = climate.GetColor(height);
        heightColor   = IsWater ? Color.black : Color.Lerp(LowColor, HighColor, height);
        tempColor     = Color.Lerp(ColdColor, HotColor, temp);
        humidityColor = Color.Lerp(DryColor, HumidColor, humidity);
    }