// default update public override UnitStatModifierConfig GetUpdatedUSMC(UnitStatModifierConfig unitStatModifierConfig, System.Object context) { // get party unit from gameObject //PartyUnit partyUnit = context.GetComponent<PartyUnit>(); // verify if party unit is not null //if (partyUnit != null) if (DoesContextMatch(context)) { // init PartyUnit from context PartyUnit partyUnit = (PartyUnit)context; // copy current USM config (to not make changes on default one) UnitStatModifierConfig newUSMConfig = Instantiate(unitStatModifierConfig); // get party unit stats upgrade count int skillLevel = partyUnit.GetUnitSkillData(associatedUnitSkillID).currentSkillLevel; // update to current USM config power based on calculation type newUSMConfig.modifierPower = Mathf.RoundToInt(newUSMConfig.modifierPower + newUSMConfig.modifierPower * skillLevel * percentToBase / 100f); // return new USM config return(newUSMConfig); } else { //Debug.LogError("Party Unit reference is null"); Debug.LogError("Context doesn't match"); } return(unitStatModifierConfig); }