private void CreateNewData() { AssetDatabase.CreateAsset(_statusEffect, $"Assets/Scriptable Objects/Status Effects/StatChange/{_buffOrDebuff}/" + _name + ".asset"); AssetDatabase.SaveAssets(); _statusEffect = CreateInstance <StatChange>(); }
public void ChangeStat(StatChange statChange) { switch (statChange.stat) { case Stat.Money: gold += statChange.change; goldText.text = gold.ToString(); break; case Stat.Population: population += statChange.change; populationText.text = population.ToString(); break; case Stat.Happiness: happiness += statChange.change; happinessText.text = happiness.ToString(); break; case Stat.Army: armyPower += statChange.change; armyText.text = armyPower.ToString(); break; case Stat.Naval: navalPower += statChange.change; navalText.text = navalPower.ToString(); break; } }
private void ApplyStatChange(Stat stat, StatChange statChange) { if (statChange.ResultBool != null) { stat.ValueBool = statChange.ResultBool.Value; } if (statChange.ResultString != null) { UpdateString(stat, statChange.ResultString); } if (statChange.ResultIntSet != null) { stat.ValueInt = statChange.ResultIntSet.Value; } if (statChange.ResultIntChange != null) { stat.ValueInt += statChange.ResultIntChange.Value; } if (statChange.ResultIntFairmath != null) { stat.ValueInt = fairmathCalculator.ApplyFairmath(stat.ValueInt, statChange.ResultIntFairmath.Value); } if (statChange.ResultObject != null) { stat.Value = statChange.ResultObject; } }
private void AddStatMod(UnitBase unit, StatChange mod) { StatusEffect match = null; foreach (var e in unit.StatusEffects. Where(e => e.effectType == EffectType.StatChange && e.name == $"{mod.affectedStat} Mod")) { match = e; } if (match != null) { var matchAsStatChange = (StatChange)match; matchAsStatChange.AddToStackAfterStatModTakesEffect(unit, mod.multiplier, mod.buff); } else { var newMod = CreateInstance <StatChange>(); newMod.CopyValues(mod); newMod.Initialize(mod.multiplier, mod.affectedStat, unit); newMod.OnAdded(unit); unit.StatusEffects.Add(newMod); runtimeEffects.Add(newMod); } }
public void AddModifier(StatModifier mod) { isDirty = true; statModifiers.Add(mod); StatChange statchange = new StatChange(this); EventManager.Current.TriggerEvent(statchange); }
private void OnStatChange(StatChange notification) { if (notification.Actor.AI.IsHero()) { if (notification.Type == typeof(Energy)) { heroEnergyText.text = notification.NewValue.ToString() + " Moves Left"; } } }
static void OnStatChanged(object sender, StatChange e) { if (e.type == Stats.HP) { if (e.toValue <= 0) Inflict(sender as Unit); else if (e.fromValue <= 0 && e.toValue > 0) Release(sender as Unit); } }
// Update is called once per frame private void Update() { m_effectStats = this; if (!Application.isPlaying && m_effectingStats == null && m_statsEffected == null) { m_effectingStats = new List <string>(); m_statsEffected = new List <string>(); m_statChanges = new StatChange(); m_statChanges = StatChange.Additive; indexValueEffecting = 0; indexValueEffected = 0; } }
static void OnStatChanged(object sender, StatChange e) { if (e.type == Stats.HP) { if (e.toValue <= 0) { Inflict(sender as Unit); } else if (e.fromValue <= 0 && e.toValue > 0) { Release(sender as Unit); } } }
public bool RemoveModifier(StatModifier mod) { if (statModifiers.Remove(mod)) { isDirty = true; StatChange statchange = new StatChange(this); EventManager.Current.TriggerEvent(statchange); } else { return(false); } return(true); }
void StatChange(StatChange statChange) { if (panelactive) { if (statTextValues.ContainsKey(statChange.Stat)) { if (statTextValues[statChange.Stat] != null) { TextMeshProUGUI statText = statTextValues[statChange.Stat]; statText.text = statChange.Stat.statName + " : " + statChange.Stat.Value.ToString(); } } } else { isdirty = true; } }
public bool Matches( StatChange[] changes, string[] reactableTypes ) { if(changes == null || changes.Length == 0) { return Matches(null, StatChangeType.Any, reactableTypes); } return changes.Any(c => Matches(c.statName, c.changeType, reactableTypes)); }
public void AddStatWatch(StatChange stat) { stats.Add(stat); }
public void AddToStat(StatChange statChange) { stats[statChange.stat] += statChange.valueChange; }
public void UpdateStats(StatChange change) { // TODO implement stat changes }