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

public class ToggleUI : MonoBehaviour {

    public GameObject[] toDisplayOnCreation;
    public GameObject[] toDisplayOnWarp;
    public GameObject[] toDisplayOnControl;

    public Dictionary<GameView, GameObject[]> displayed;

    GameView _prevFrameView;

    private void Start()
    {
        displayed = new Dictionary<GameView, GameObject[]>();
        displayed[GameView.DroneCreation] = toDisplayOnCreation;
        displayed[GameView.WarpSelection] = toDisplayOnWarp;
        displayed[GameView.DroneControl] = toDisplayOnControl;

        foreach (GameObject go in displayed[Game.instance.currentView])
            go.SetActive(true);
    }

	void Update () {
        if (_prevFrameView != Game.instance.currentView)
        {
            foreach (GameObject go in displayed[_prevFrameView])
                go.SetActive(false);
            foreach (GameObject go in displayed[Game.instance.currentView])
                go.SetActive(true);
            _prevFrameView = Game.instance.currentView;
        }
	}
}
