public void SetTargetBeing (ABeing _target) { Formula.SetTargetBeing (_target); }
public abstract void Apply(ABeing target);
public override void Apply (ABeing target) { this.SetTargetBeing (target); Dictionary<string, double> quantities = new Dictionary<string, double>(); Dictionary<BEING_KEY, ABeing> destinations = new Dictionary<BEING_KEY, ABeing>(); destinations.Add (BEING_KEY.SELF, mSelfBeing); destinations.Add (BEING_KEY.TARGET, target); double quantityForThisRun = MaxQuantityPerRun; foreach (InOutVariable v in mInOuts) { Variable var = destinations[v.Destination].GetVariable (v.VariableName); // Compute quantity according to formula quantities.Add(v.VariableName, v.Formula.GetResult()); if (!v.IsOutput) { //Computes the maximum amount of each ressource we can consume. quantityForThisRun = Math.Min (var.GetValue () / quantities [v.VariableName], quantityForThisRun); } } foreach (InOutVariable v in mInOuts) { Variable var = destinations[v.Destination].GetVariable (v.VariableName); //Adjust quantity according to amount consumed or produced var.SetValue (var.GetValue () + quantityForThisRun * v.OutputFactor * quantities [v.VariableName]); } this.SetTargetBeing (null); }
public void SetSelfBeing (ABeing _self) { Formula.SetSelfBeing (_self); foreach(AValue v in Formula.GetAllBindedValues()) { v.Change += Refresh; } }
public void SetSelfBeing (ABeing _self) { Debug.Assert (mIsInitialized, "Calling SetSelfBeing on a non-initialized formula on component " + Error.Hierarchy(mParent.GetComponent())); mSelf = _self; foreach (Parameter p in mParameters.Values) { if (p.beingKey == BEING_KEY.SELF) { if (_self == null) { p.bindedValue = null; } else { p.bindedValue = _self.GetValue (p.valueName); } } } }
public void SetTargetBeing (ABeing _target) { Debug.Assert (mIsInitialized, "Calling SetTargetBeing on Transformation " + Error.Hierarchy (this) + " while it is not yet initialized"); foreach (InOutVariable v in mInOuts) { v.Formula.SetSelfBeing (_target); } }
public override void Apply (ABeing target) { // TODO }
public override void Apply(ABeing target) { Debug.Log (Message); }
// protected Dictionary<string,ATrigger> trigger = new Dictionary<string, ATrigger> (); public void SetParentBeing(ABeing parent) { mParent = parent; }
public void Go(ABeing target) { foreach (AEffect effect in mEffects) { effect.Apply (target); } }
public void setParentBeing(ABeing parent) { parentBeing = parent; }