using UnityEngine;
using System.Collections;

public class ProcessPlay : Process {

    [SerializeField]
    private GameObject popup;
    [SerializeField]
    private GameObject scene;

    public override void AfterActivation()
    {
        base.AfterActivation();
        popup.SetActive(false);
    }

    // Update is called once per frame
    void Update () {

        if(Input.GetKey(KeyCode.Escape) || Input.GetKey(KeyCode.P))
        {
            popup.SetActive(true);
            scene.SetActive(false);
        }

    }

    public void OnResumeButton()
    {
        popup.SetActive(false);
        scene.SetActive(true);
        SoundDispenser.instance.clickOnButton.Play();
    }

    public void OnMenuButton()
    {

        for (int i = 0; i < scene.transform.childCount; i++)
        {
            Destroy(scene.transform.GetChild(i).gameObject);
        }
        scene.SetActive(true);
        StateMachine.instance.UpdateState(StateMachine.STATE.MENU);
        SoundDispenser.instance.clickOnButton.Play();
    }

}
