void Start() { // Set instance to this object if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } // Avoid music stopping on alt tab Application.runInBackground = true; // Initialize quadtree and meshpool quadtree.Init(); meshpool.Init(); // Initialize player player.Init(); dialogue.StartDialogue(); quadtree.player = player; if (Application.isPlaying) { audioManager.Init(); audioManager.PlayMusic(stageMusic, stageMusic_spirit, stageStartLoop); } if (dialogue.isActiveAndEnabled) { StartCoroutine(dialogue.StartDialogue()); StartCoroutine(MoveCameraAfterDialogueEnd()); } // Initialize enemies enemies = FindObjectsOfType(typeof(Enemy)) as Enemy[]; for (int i = 0; i < enemies.Length; ++i) { enemies[i].Init(); } meshpool.UpdateAt(0); }
void OnEnable() { // Set instance to this object if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } InitializeCameraSettings(); // Initialize quadtree and meshpool quadtree.Init(); meshpool.Init(); border.Init(); border.obj.Scale = new Vector3(scale_factor, scale_factor); //origin.position = border.obj.OBB.FL; background.position = ComputePosition(new Vector3(-96, 0, 10)); background.localScale = ComputeScale(new Vector3(384, 448)); dialogue.Init(); // Initialize player player.Init(); // Initialize bomb and life bars lifebar.Init(); bombbar.Init(); lifetext.Init(); bombtext.Init(); // Initialize enemies for (int i = 0; i < enemies.Count; ++i) { enemies[i].Init(); } meshpool.UpdateAt(0); }