protected override void OnProcessOutputSchema(MutableObject newSchema) { foreach (var entry in ValueField.GetEntries(newSchema)) { Proportion.SetValue(.5f, entry); } Router.TransmitAllSchema(newSchema); }
protected override MutableObject Mutate(MutableObject mutable) { var entries = ValueField.GetEntries(mutable); if (entries.Count() < 1) { return(mutable); } float maxValue = ValueField.GetValue(entries.First()); float minValue = maxValue; foreach (var entry in ValueField.GetEntries(mutable)) { float foundValue = ValueField.GetValue(entry); if (maxValue < foundValue) { maxValue = foundValue; } if (minValue > foundValue) { minValue = foundValue; } } float range = Mathf.Abs(maxValue - minValue) < .00001f ? 1f : maxValue - minValue; foreach (var entry in ValueField.GetEntries(mutable)) { float foundValue = ValueField.GetValue(entry); Proportion.SetValue((foundValue - minValue) / range, entry); } return(mutable); }