//battle ended public static void BattleEnded(int vicFactionID) { battleEnded = true; if (instance.playerFactionID.Contains(vicFactionID)) { //if(vicFactionID==GetPlayerFactionID()){ GainPoint(instance.winPointReward); //if using persistent data, save the point gain in this level if (instance.loadMode == _LoadMode.UsePersistantData) { //instance.pointGain+=instance.winPointReward; GlobalStatsTB.GainPlayerPoint(instance.pointGain); } } if (onBattleEndE != null) { onBattleEndE(vicFactionID); } }
public static bool UnlockPerk(PerkTB perk, bool flag) { if (perk.unlocked) { Debug.Log("attemp to unlock unlocked perk"); return(false); } perk.unlocked = true; perkPoint += 1; if (flag) { if (!instance.usePersistentData) { instance.point -= perk.cost; } else { GlobalStatsTB.GainPlayerPoint(-perk.cost); } } if (perk.applyToAllUnit) { for (int i = 0; i < perk.effects.Count; i++) { PerkEffectTB effect = perk.effects[i]; int effectID = (int)effect.type; if (effect.isModifier) { globalUnitStats.stats[effectID].mod += effect.value; } else { globalUnitStats.stats[effectID].value += effect.value; } } } else { for (int i = 0; i < unitStats.Count; i++) { if (perk.unitPrefab.Contains(unitStats[i].unit)) { perk.unitPrefabID.Add(unitStats[i].unit.prefabID); for (int j = 0; j < perk.effects.Count; j++) { PerkEffectTB effect = perk.effects[j]; int effectID = (int)effect.type; if (effect.isModifier) { unitStats[i].stats[effectID].mod += effect.value; } else { unitStats[i].stats[effectID].value += effect.value; } } break; } } } if (onPerkUnlockE != null) { onPerkUnlockE(perk); } return(true); }