/******************************************************************************** * ------------------------------- COMBAT SECTION --------------------------------- ********************************************************************************* * -This section contains all functions related to player and CPU combat ********************************************************************************/ public void TriggerCombat(GameObject trigger) { //Fix sorting order NumberOfSpritesBehind = 0; GetComponent <SpriteRenderer>().sortingLayerName = DefaultSortingLayer; GetComponent <SpriteRenderer>().sortingOrder = DefaultSortingOrder; DontDestroyOnLoad(objectSpawner); objectSpawner.HideObjects(); //move player to combat instance //save current position _combatPosition = transform.position; if (IsTest) { nextLevel = new SceneManagerInstance(GameObject.FindGameObjectWithTag("SceneManager").GetComponent <SceneManager>()); } else { nextLevel.name = Application.loadedLevelName; } //save portal as combat details for loading combat combatDetails = trigger; //removeFromSceneManager(other.gameObject); //protect components DoNotDestroy(); //Heal PostBattleRecovery(); //load fight RemoveFromSceneManager(trigger); Application.LoadLevel("Combat"); }