using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Audio; namespace HeavenStudio { public class Initializer : MonoBehaviour { public TextAsset level; public AudioClip music; public bool debugUI; public bool playOnStart = false; public bool editor = false; private void Start() { GameObject Cameras = Instantiate(Resources.Load("Prefabs/Cameras")); Cameras.name = "Cameras"; GameObject MainCamera = Cameras.transform.GetChild(0).gameObject; GameObject CursorCamera = Cameras.transform.GetChild(1).gameObject; GameObject Cursor = Instantiate(Resources.Load("Prefabs/Cursor")); Cursor.name = "Cursor"; GameObject Games = new GameObject(); Games.name = "Games"; GameObject GameManager = new GameObject(); GameManager.name = "GameManager"; GameManager gameManager = GameManager.AddComponent(); gameManager.playOnStart = playOnStart; gameManager.txt = level; gameManager.GamesHolder = Games; gameManager.CircleCursor = Cursor.transform.GetChild(0).GetComponent(); gameManager.GameCamera = MainCamera.GetComponent(); gameManager.CursorCam = CursorCamera.GetComponent(); GameObject Profiler = Instantiate(Resources.Load("Prefabs/GameProfiler")); Profiler.name = "GameProfiler"; if (!debugUI) { Profiler.GetComponent().enabled = false; Profiler.transform.GetChild(0).gameObject.SetActive(false); } GameObject Conductor = new GameObject(); Conductor.name = "Conductor"; AudioSource source = Conductor.AddComponent(); source.clip = music; Conductor.AddComponent(); Conductor.GetComponent().musicSource = source; source.outputAudioMixerGroup = Settings.GetMusicMixer(); // Conductor.AddComponent(); if (editor) { this.GetComponent().Init(); } else { gameManager.Init(); } } } }