using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class WorldInfo : MonoBehaviour {

    public Text text;
    public World world;
	void Update () {
        if (world == null) return;
        var avgTemp = world.tiles.Average(t => t.temperature);
        var isLife = world.tiles.Any(t => t.abundance > 0);
        var maxLife = world.tiles.Max(t => t.intelligence);
        text.text = "~  " + world.name + "  ~\n";
        if (!isLife)
            text.text += "Dead World";
        else
            text.text += "Life: " + maxLife;
        text.text += ". Average " + Tile.TempToString(avgTemp);
	}
}
