using System;
using UnityEngine;
using mgaia.Utils;
using mgaia.Utils.LayerSystem;

public class Main : MonoBehaviour
{
    private void Awake()
    {
        DontDestroyOnLoad(gameObject);

        Screen.orientation = ScreenOrientation.AutoRotation;
        Screen.autorotateToLandscapeLeft = true;
        Screen.autorotateToLandscapeRight = true;
        Screen.autorotateToPortrait = false;
        Screen.autorotateToPortraitUpsideDown = false;

        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        UnityEngine.Random.seed = (int)DateTime.Now.Ticks;

        LocalizationManager.LoadWithoutFallback<mgaia.M2HLocalization.M2HLocalizationParser>();

        LayerManager.Initialize(GameConstants.DEFAULT_WIDTH, GameConstants.DEFAULT_HEIGHT, GameConstants.TARGET_ORTOGRAPHIC_SIZE);

        CodeAnimationManager.Initialize();

        Application.LoadLevel("Gameplay");
    }

    private void Start()
    {
        Sound.PlayMusic();
    }
}