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

public class PreGame : MonoBehaviour
{
    public uint pawncount { get; set; }
    public int scorelimit { get; set; }

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        GameObject.Find("pawntext").GetComponent<Text>().text = GameObject.Find("pawn_quantity").GetComponent<Slider>().value.ToString();
        GameObject.Find("scoretext").GetComponent<Text>().text = GameObject.Find("score_limit").GetComponent<Slider>().value.ToString();
    }

    private void Awake()
    {
        DontDestroyOnLoad(this);
    }

    public void loadgame()
    {
        pawncount = Convert.ToUInt16(GameObject.Find("pawn_quantity").transform.GetComponent<Slider>().value);
        scorelimit = Convert.ToInt16(GameObject.Find("score_limit").transform.GetComponent<Slider>().value);
        SceneManager.LoadScene("MainGame", LoadSceneMode.Additive);
        GameObject.Find("Audio Source").GetComponent<AudioSource>().clip = Resources.Load<AudioClip>("Sound/(In Game)Routine_2");
        GameObject.Find("Audio Source").GetComponent<AudioSource>().Play();
    }

    public void backdestroyinit()
    {
        UnityEngine.Object.Destroy(GameObject.Find("init"), 0);
    }
}
