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

public class WorldSelectionController : MonoBehaviour {

    public int worldIndex;

    public Text cost;
    public Text worldName;

    World world { get { return Game.instance.worlds[worldIndex].world; } }
    WorldGenConfig worldConfig { get { return Game.instance.configurations[worldIndex]; } }

    public void OnClick()
    {
        var droneToMove = DroneController.active;
        var currentWorld = droneToMove.worldIndex;
        var action = new HyperJump(worldIndex, currentWorld);
        droneToMove.Enqueue(action);
    }
	
	void Update () {
        worldName.text = worldConfig.name;
        var activeDrone = DroneController.active;
        if (activeDrone == null)
            cost.text = "";
        else
        {
            var currentWorld = DroneController.active.worldIndex;
            cost.text = new HyperJump(worldIndex, currentWorld).cost.ToString() + " kJ";
        }
	}
}
