using System.Collections;
using System.Collections.Generic;
using System;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class ControllerPause : MonoBehaviour
{

    public GameObject PauseCanvas;

    public GameObject Megafono;

    public GameObject PauseMenu;
    public GameObject ConfigMenu;
    
    public GameObject ConfigButton;
    public GameObject MainMenuButton;
    public GameObject UnpauseButton;

    public GameObject BackButton;

    private Button configButton;
    private Button mainMenuButton;
    private Button unpauseButton;

    private Button backButton;

    private int iteratorAnimationMegafono;
    private int iteratorAnimationPauseMenu;
    private int iteratorAnimationConfigMenu;

    private int flag = 0;

    // Use this for initialization
    void Start ()
    {
        PauseCanvas.SetActive(true);
        iteratorAnimationMegafono = 0;
        iteratorAnimationPauseMenu = 0;
        iteratorAnimationConfigMenu = 0;

        configButton = ConfigButton.GetComponent<Button>();
        configButton.onClick.AddListener(ConfigPage);
        mainMenuButton = MainMenuButton.GetComponent<Button>();
        mainMenuButton.onClick.AddListener(MainMenu);
        unpauseButton = UnpauseButton.GetComponent<Button>();
        unpauseButton.onClick.AddListener(Unpause);
        backButton = BackButton.GetComponent<Button>();
        backButton.onClick.AddListener(CloseConfigPanel);

    }
	
	// Update is called once per frame
	void Update ()
    {
		if(flag == 0)
        {
            if (iteratorAnimationMegafono <= 14)
            {
                Megafono.transform.Rotate(0, 0, 6);
                iteratorAnimationMegafono++;
            }
            if (iteratorAnimationMegafono > 14 && iteratorAnimationMegafono <= 19)
            {
                Megafono.transform.Rotate(0, 0, -1);
                iteratorAnimationMegafono++;
            }

            if(iteratorAnimationPauseMenu<= 10)
            {
                PauseMenu.transform.Translate(0,10,0);
                iteratorAnimationPauseMenu++;
            }
            if (iteratorAnimationPauseMenu > 10 && iteratorAnimationPauseMenu <= 15)
            {
                PauseMenu.transform.Translate(0, -5, 0);
                iteratorAnimationPauseMenu++;
            }
        }
    }

    void ConfigPage()
    {

    }

    void CloseConfigPanel()
    {

    }
    
    void MainMenu()
    {

    }

    void Unpause()
    {

    }
}
