public void FleePlayer() { // get parties before UI is destoyed HeroParty playerHeroParty = playerPartyPanel.GetHeroParty(); HeroParty enemyHeroParty = enemyPartyPanel.GetHeroParty(); // exit battle DefaultOnBattleExit(); // start flee animation FleeXFromY(playerHeroParty, enemyHeroParty); }
//MapManager GetMapManager() //{ // return transform.root.Find("MapScreen/Map").GetComponent<MapManager>(); //} void DefaultOnBattleExit() { //// if hero is still alive, then set click handler to edit mode //if (GetBattleExitButton().GetExitOption() != BattleExit.ExitOption.DestroyPlayer) //{ // // activate hero edit click and drag handler // playerPartyPanel.SetOnEditClickHandler(true); // // deactivate battle click handler, which will react on clicks // playerPartyPanel.SetOnBattleClickHandler(false); //} // Activate other required screen based on the original parties location // Always start with map screen, no matter where battle took place // Enable map screen MapMenuManager.Instance.gameObject.SetActive(true); // Activate map MapManager.Instance.gameObject.SetActive(true); // Change map mode to browse //MapManager mapManager = GetMapManager(); MapManager.Instance.SetMode(MapManager.Mode.Browse); // Move heroes parties to thier initial positions before battle // Verify if player party is not destroyed //if (playerPartyPanel) //{ // playerPartyPanel.GetHeroParty().transform.SetParent(playerPartyPanel.GetHeroParty().PreBattleParentTr); //} // Verify if enemy party is not destroyed //if (enemyPartyPanel) //{ // enemyPartyPanel.GetHeroParty().transform.SetParent(enemyPartyPanel.GetHeroParty().PreBattleParentTr); //} // Reset almost all units statuses and info for panels, if they are still present // Exceptions: Dead // Verify if player party is not destroyed if (playerPartyPanel) { playerPartyPanel.ResetUnitCellInfoPanel(); playerPartyPanel.ResetUnitCellStatus(new string[] { playerPartyPanel.deadStatusText }); playerPartyPanel.ResetUnitCellHighlight(); // set map focus MapMenuManager.Instance.GetComponentInChildren <MapFocusPanel>().SetActive(playerPartyPanel.GetHeroParty().LMapHero); } // Verify if enemy party is not destroyed if (enemyPartyPanel) { enemyPartyPanel.ResetUnitCellInfoPanel(); enemyPartyPanel.ResetUnitCellStatus(new string[] { enemyPartyPanel.deadStatusText }); enemyPartyPanel.ResetUnitCellHighlight(); } // Close battle screen gameObject.SetActive(false); }
public void DestroyParty(PartyPanel partyPanel) { Debug.Log("Destroy party"); // set variables HeroParty heroParty = partyPanel.GetHeroParty(); MapHero heroOnMapRepresentation = heroParty.LMapHero; MapObjectLabel heroOnMapLabel = heroOnMapRepresentation.GetComponent <MapObject>().Label; // destroy label Destroy(heroOnMapLabel.gameObject); // destroy on map party representation Destroy(heroOnMapRepresentation.gameObject); // destroy party Destroy(heroParty.gameObject); }