Пример #1
0
 public Tile(int x, int y, float height, float temp, float humidity)
 {
     this.x        = x;
     this.y        = y;
     this.height   = height;
     this.temp     = temp;
     this.humidity = humidity;
     Climate       = GameController.Climates.First(climate => climate.CorrectTile(this));
     color         = Climate.GetColor(height);
     heightColor   = Color.Lerp(Color.black, Color.white, height);
     tempColor     = Color.Lerp(Color.cyan, Color.red, temp);
     humidityColor = Color.Lerp(Color.yellow, Color.blue, humidity);
 }
Пример #2
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);
    }
Пример #3
0
 public void SetRegion(Region newRegion)
 {
     region  = newRegion;
     Climate = region.climate;
     color   = Climate.GetColor(height);
 }