int GetLeadershipConsumedByPartyUnitsExcludingLeader(PartyUnit partyUnit) { // get unit party HeroParty heroParty = partyUnit.GetUnitParty(); // verify if unit is member of party if (heroParty != null) { Debug.LogWarning("!!Convert UnitSize to class!!"); return(heroParty.GetLeadershipConsumedByPartyUnits() - (int)heroParty.GetPartyLeader().UnitSize - 1); } else { Debug.Log("Unit without party"); return(0); } //// structure 5PartyPanel-4Row-3Cell-2UnitSlot-1UnitCanvas-Unit //PartyPanel partyPanel = null; //if (partyUnit.transform.parent) // if (partyUnit.transform.parent.parent) // if (partyUnit.transform.parent.parent.parent) // if (partyUnit.transform.parent.parent.parent.parent) // if (partyUnit.transform.parent.parent.parent.parent.parent) // partyPanel = partyUnit.transform.parent.parent.parent.parent.parent.GetComponent<PartyPanel>(); //if (partyPanel != null) //{ // return partyPanel.GetNumberOfPresentUnits() - 1; //} //else //{ // return 0; //} }