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; //} }
public void OnActiveUnitChange(PartyUnit partyUnit) { if (partyUnit.GetUnitParty().CanEscapeFromBattle) { // activate this button gameObject.SetActive(true); } else { // deactivate this button gameObject.SetActive(false); } }
//public bool MatchScope(PartyUnit srcPartyUnitUPMOwner, PartyUnit dstPartyUnit) //{ // // Match // switch (ModifierScope) // { // case ModifierScope.Self: // // verify if source and destination party units are the same // if (srcPartyUnitUPMOwner.GetInstanceID() == dstPartyUnit.GetInstanceID()) // { // return true; // } // else // { // return false; // } // case ModifierScope.SingleUnit: // case ModifierScope.EntireParty: // case ModifierScope.AllPlayerUnits: // Debug.LogError("Finish this function logic implementation"); // return true; // default: // Debug.LogError("Unknown modifier scope: " + ModifierScope.ToString()); // return false; // } //} public bool MatchRelationships(PartyUnit srcPartyUnitUPMOwner, PartyUnit dstPartyUnit) { // get relationships Relationships.State relationships = Relationships.Instance.GetRelationships(srcPartyUnitUPMOwner.GetUnitParty().Faction, dstPartyUnit.GetUnitParty().Faction); // loop through all required relationships foreach (Relationships.State relation in RequiredRelationships) { // verify if relationships match if (relation == relationships) { return(true); } } // if none of required relations match return false return(false); }