using UnityEngine;
using System.Collections;

public class ProcessMenu : Process {

    [SerializeField]
    private GameObject menuBackground3D;

    private Transform cameraPosition;

    public override void Init()
    {
        base.Init();

        cameraPosition = GameObject.FindGameObjectWithTag("MainCamera").transform;

    }

    public override void AfterActivation()
    {
        base.AfterActivation();
        menuBackground3D.SetActive(true);
        GameObject.FindGameObjectWithTag("MainCamera").transform.position = cameraPosition.position;
        GameObject.FindGameObjectWithTag("MainCamera").transform.rotation = cameraPosition.rotation;
    }

    public override void AfterInactivation()
    {
        base.AfterInactivation();
        menuBackground3D.SetActive(false);
    }

    public void OnClickPlayButton()
    {
        StateMachine.instance.UpdateState(StateMachine.STATE.LISTOFLEVELS);
        SoundDispenser.instance.clickOnButton.Play();
    }

    public void OnClickControlsButton()
    {
        StateMachine.instance.UpdateState(StateMachine.STATE.CONTROLS);
        SoundDispenser.instance.clickOnButton.Play();
    }

    public void OnClickQuitButton()
    {
        StateMachine.instance.UpdateState(StateMachine.STATE.QUIT);
        SoundDispenser.instance.clickOnButton.Play();
    }
}
