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

public class GameLevel : MonoBehaviour
{
    public static GameLevel Instance;

    void Awake()
    {
        if (Instance != null)
            Destroy(gameObject);

        Instance = this;
    }

    void OnDisable()
    {
        Instance = null;
    }

    public GameObject[] Characters;
    public Transform SpawnPoint1;
    public Transform SpawnPoint2;

    // Use this for initialization
    void Start()
    {
        SpawnCharacters();
    }

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

    }

    private void SpawnCharacters()
    {
        int character1Id = PlayerPrefs.GetInt("Player1");
        int character2Id = PlayerPrefs.GetInt("Player2");

        Instantiate(Characters[character1Id], SpawnPoint1.position, Quaternion.identity);
        Instantiate(Characters[character2Id], SpawnPoint2.position, Quaternion.Euler(0, 0, 180)).GetComponent<PlayerController>().Number = 2;
    }
}
