예제 #1
0
    public void Rotate()
    {
        SetInteractable(false);
        puzzle.Rotation = (++puzzle.Rotation) % 4;

        Vector3 currentRotation = puzzle.transform.rotation.eulerAngles;
        Vector3 targetRotation  = currentRotation - new Vector3(0f, 0f, 90f);

        var data = new InterpolationData <Vector3>(ChangeRotation, currentRotation, targetRotation, rotateDuration, AnimationHelper.LinearCurve, MakeInteractable);

        Interpolator.Interpolate(data);

        OrderController.MoveToTop(puzzle);
    }
        protected virtual void OnGUICurve(ref Rect contentRect, Interpolator dummyInstance, AnimationCurveUtility.TangentMode mode = AnimationCurveUtility.TangentMode.Smooth)
        {
            if (null == dummyInstance)
            {
                return;
            }

            var count     = 100;
            var keyFrames = new Keyframe[count];

            for (int n = 0; n < count; ++n)
            {
                var t = n / (float)(count - 1);
                var k = new Keyframe(t, dummyInstance.Interpolate(t));
                keyFrames[n] = k;
            }

            var curve = new AnimationCurve(keyFrames);

            AnimationCurveUtility.SetLinear(ref curve, mode);

            contentRect.height = InterpolatorPropertyDrawer.heightCurve;
            EditorGUI.CurveField(contentRect, curve);
            contentRect.y += InterpolatorPropertyDrawer.heightCurve;
        }
예제 #3
0
        public void Update(float seconds)
        {
            if (!_isTransitioning)
            {
                return;
            }

            _transitionCurrentTime += seconds;

            _fraction = _transitionCurrentTime / _transitionTotalTime;

            if (_fraction >= 1.0f)
            {
                _fraction        = 1.0f;
                _isTransitioning = false;
            }

            _current.SingleColour = Interpolator.Interpolate(_previous.SingleColour, _target.SingleColour, ref _fraction);
            _current.Negative     = Interpolator.Interpolate(_previous.Negative, _target.Negative, ref _fraction);
            _current.Colourise    = Interpolator.Interpolate(_previous.Colourise, _target.Colourise, ref _fraction);
            _current.GrayScale    = Interpolator.Interpolate(_previous.GrayScale, _target.GrayScale, ref _fraction);
            _current.Opacity      = Interpolator.Interpolate(_previous.Opacity, _target.Opacity, ref _fraction);
            _current.ColourForSingleColourAndColourise = Interpolator.Interpolate(_previous.ColourForSingleColourAndColourise, _target.ColourForSingleColourAndColourise, ref _fraction);
            _current.BackgroundClearColour             = Interpolator.Interpolate(_previous.BackgroundClearColour, _target.BackgroundClearColour, ref _fraction);
            _current.ClearBackground = _fraction == 1.0f ? _target.ClearBackground : _previous.ClearBackground;

            UpdateBufferAndClearColour();
        }
예제 #4
0
        public double[] GetPhase(double[] symmetryPulse, Complex[] correspondSpectrum)
        {
            if (_interpolator == null || _phaseArray == null)
            {
                _interpolator = new Interpolator(_centerHalfWidth * 2, symmetryPulse.Length);
                _phaseArray   = new double[symmetryPulse.Length / 2];
            }
            // extract central portion
            var centerBurst  = symmetryPulse.Length / 2;
            var centralPulse = _centerRealContainer;

            Array.Copy(symmetryPulse, centerBurst - _centerHalfWidth, centralPulse, 0, _centerHalfWidth * 2);
            // apodize & rotate
            _apodizer.Apodize(centralPulse);
            _rotator.Rotate(centralPulse);
            // fft
            _centerRealContainer.ToComplex(_centerComplexContainer);
            Fourier.Forward(_centerComplexContainer, FourierOptions.Matlab);
            // get phase from spectrum
            var complexSpectrum = _centerComplexContainer;

            for (var i = 0; i < _centerRealContainer.Length; i++)
            {
                _centerRealContainer[i] = _complexToPhaseFunc(complexSpectrum[i]);
            }
            // interpolate into full length
            _interpolator.Interpolate(_centerRealContainer, _phaseArray);
            return(_phaseArray);
        }
        public void ShowSqlCreator()
        {
            if (_appConfig.GetCredentialsRequired == AppConfig.CredentialsRequired.None || _appConfig.User != null)
            {
                var          sqlCreator = new SqlCreatorView(_appConfig, _workbookPropertiesConfig);
                DialogResult result     = sqlCreator.ShowDialog();
                if (result == DialogResult.OK)
                {
                    _workbookPropertiesConfig = sqlCreator.WorkbookPropertiesConfig;

                    var queries = new Dictionary <string, DataTable>();
                    queries = sqlCreator.SQLResult; // add main query to dict

                    //if (_workbookPropertiesConfig.LastMainQuery != null)
                    //{
                    var dbConnection = new DatabaseConnectionFactory().CreateDbConnection(_appConfig.DatabaseType, _appConfig.ConnectionString);
                    foreach (KeyValuePair <string, string> query in _workbookPropertiesConfig.AdditionalQueriesAsDictionary())
                    {
                        // create interpolator object
                        var interpolator = new Interpolator();

                        // test if string needs interpolation
                        var needsInterpolation = interpolator.SetFormattable(query.Value).SetCriteria(_workbookPropertiesConfig.LastMainQuery.Criteria).NeedsInterpolation();

                        // if no, then use sql to query against database and add results to queries dict
                        if (!needsInterpolation)
                        {
                            try
                            {
                                queries.Add(query.Key, dbConnection.Query(query.Value));
                            }
                            catch
                            {
                                MessageBox.Show($"{query.Key} did not run successfully", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            // if yes, then interpolate
                            try
                            {
                                var interpolatedQuery = interpolator.Interpolate();
                                queries.Add(query.Key, dbConnection.Query(interpolatedQuery));
                            }
                            catch
                            {
                                MessageBox.Show($"{query.Key} did not run successfully", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                    //}

                    _presenter.PasteQueriesIntoExcel(queries);
                }
            }
            else
            {
                LogIn();
            }
        }
예제 #6
0
        public static void ExampleInterpolatorUse()
        {
            Interpolator
                interpolator =
                Interpolator.CreateInterpolator(Slerp,
                                                Arch2); //Creates interpolation (first Slerp T then use it to create arch2)

            interpolator =
                Interpolator.CreateInterpolator(Flip, Slerp                            //Normal Interpolation Delegate
                                                , (float time) => SmoothStart(time, 1) //Sometimes you need to use anonymous functions.(GOD BLESS C#)
                                                );                                     //Creates interpolation (first Slerp T then use it to plug a SmoothStartCurve)

            Interpolator test = Interpolator.CreateInterpolator(Flip, Flip);


            for (int i = 0; i < 10000; i++)
            {
                float t  = i / 10000f;
                float ff = test.Interpolate(t);
            }

            test = Interpolator.CreateInterpolator(Flip);
            for (int i = 0; i < 10000; i++)
            {
                float t  = i / 10000f;
                float hh = interpolator.Interpolate(t);
            }
        }
        public void NodeInterpolationTest(string meshFileName, CircularValueTypes cvt = CircularValueTypes.Normal)
        {
            // Source mesh
            MeshFile meshFile = MeshFile.ReadMesh(meshFileName);
            MeshData mesh     = meshFile.ToMeshData();

            // Allow for extrapolation on boundary nodes (disable clipping)
            MeshNodeInterpolation interpolation = new MeshNodeInterpolation(mesh)
            {
                AllowExtrapolation = true,
            };

            interpolation.Setup();
            Interpolator nodeInterpolator = interpolation.NodeInterpolator;

            nodeInterpolator.CircularType = cvt;

            // Find reference x and y value as the smallest x and y value
            double xMin = mesh.Nodes.Select(mn => mn.X).Min();
            double xMax = mesh.Nodes.Select(mn => mn.X).Max();
            double yMin = mesh.Nodes.Select(mn => mn.Y).Min();
            double yMax = mesh.Nodes.Select(mn => mn.Y).Max();

            // Function over the (x,y) plane.
            Func <double, double, double> function = ValueFunction(cvt, xMin, yMin, xMax, yMax);

            // Calculate element center values
            double[] elmtVals = new double[mesh.Elements.Count];
            for (int i = 0; i < mesh.Elements.Count; i++)
            {
                MeshElement elmt = mesh.Elements[i];
                elmtVals[i] = function(elmt.XCenter, elmt.YCenter);
            }

            // Write out bounds, to check we got things right
            Console.Out.WriteLine("{0,10} (min,max) = ({1},{2})", cvt, elmtVals.Min(), elmtVals.Max());

            // Interpolate to nodes
            double[] nodeValues = new double[mesh.Nodes.Count];
            nodeInterpolator.Interpolate(elmtVals, nodeValues);

            // Check node values
            for (int i = 0; i < mesh.Nodes.Count; i++)
            {
                MeshNode node        = mesh.Nodes[i];
                double   exactValue  = function(node.X, node.Y);
                double   interpValue = nodeValues[i];
                double   diff        = exactValue - interpValue;
                // It can only extrapolate when there is at least three elements per node.
                // When there is two or less elements, the inverse distance weighting takes over
                // and the results are not correct, so we skip the check here.
                if (node.Elements.Count > 2 && diff > 1e-6)
                {
                    string msg = string.Format("{0,2} {6}: {1}-{2}={3} ({4},{5})", i, exactValue, interpValue, diff, node.X, node.Y, node.Elements.Count);
                    Console.Out.WriteLine(msg);
                    Assert.Fail(msg);
                }
            }
        }
예제 #8
0
    private void AnimateSlide()
    {
        Vector3 destination = gallery.GetSlidePosition();

        collider.enabled = false;
        var data = new InterpolationData <Vector3>(slide, scroll.localPosition, destination, slideDuration, slideCurve, enableCollider);

        interpolator.Interpolate(data);
    }
예제 #9
0
        public TypeOfValue GetStateAt(TimeSpan intentRelativeTime)
        {
            TypeOfValue value;

            if (_interpolator.Interpolate(intentRelativeTime, TimeSpan, StartValue, EndValue, out value))
            {
                return(value);
            }
            return(default(TypeOfValue));
        }
예제 #10
0
        public void Interpolator_Int_ReturnsMidPoint()
        {
            var initial  = 3;
            var final    = 7;
            var fraction = 0.5f;

            var result = Interpolator.Interpolate(initial, final, ref fraction);

            Assert.Equal(5, result);
        }
예제 #11
0
        void iterateForward()
        {
            var toSleep = _durationMillis / _iterationCount;

            for (int iter = currentPosition; iter <= _iterationCount; iter++)
            {
                if (!pause)
                {
                    Thread.Sleep(toSleep);
                    _onNext?.Invoke(iter, _interpolator.Interpolate(iter, _iterationCount));
                    currentPosition = iter;
                    if (iter == 500)
                    {
                        pause = true;
                        break;
                    }
                }
            }
        }
예제 #12
0
        public void Interpolator_Colour_ReturnsMidPoint()
        {
            var initial  = new Colour(1.0f, 0.0f, 0.5f, 0.0f);
            var final    = new Colour(0.5f, 0.5f, 0.7f, 0.5f);
            var fraction = 0.5f;

            var result = Interpolator.Interpolate(initial, final, ref fraction);

            Assert.Equal(new Colour(0.75f, 0.25f, 0.6f, 0.25f), result);
        }
예제 #13
0
        public void Interpolator_Vector4_ReturnsMidPoint()
        {
            var initial  = new Vector4(0.0f, 3.0f, 4.0f, -20.0f);
            var final    = new Vector4(4.0f, 7.0f, -10.0f, 135.0f);
            var fraction = 0.5f;

            var result = Interpolator.Interpolate(initial, final, ref fraction);

            Assert.Equal(new Vector4(2.0f, 5.0f, -3.0f, 57.5f), result);
        }
예제 #14
0
        public T GetValue(KDateTime label)
        {
            if (Keys.Contains(label))
            {
                return(Values[Keys.IndexOf(label)]);
            }

            return(Interpolator <KDateTime, T>
                   .Interpolate(Keys, Values, label, InterpolType));
        }
예제 #15
0
        public virtual T GetStateAt(TimeSpan segmentRelativeTime)
        {
            T value;

            if (_interpolator.Interpolate(segmentRelativeTime, TimeSpan, StartValue, EndValue, out value))
            {
                return(value);
            }
            return(default(T));
        }
예제 #16
0
        public void Interpolator_Float_ReturnsMidPoint()
        {
            var initial  = 3.0f;
            var final    = 6.0f;
            var fraction = 0.5f;

            var result = Interpolator.Interpolate(initial, final, ref fraction);

            Assert.Equal(4.5f, result);
        }
예제 #17
0
파일: Commons.cs 프로젝트: asmboom/vengine
        private static void InterpolateCameraFromSaved(int index)
        {
            if (!CameraSavedViews.ContainsKey(index))
            {
                return;
            }
            var pos    = CameraSavedViews[index].GetPosition();
            var orient = CameraSavedViews[index].GetOrientation();

            Interpolator.Interpolate <Vector3>(FreeCam.Cam.Transformation.Position, FreeCam.Cam.Transformation.Position.R, pos, 8.0f, Interpolator.Easing.EaseInOut);
            Interpolator.Interpolate <Quaternion>(FreeCam.Cam.Transformation.Orientation, FreeCam.Cam.Transformation.Orientation.R, orient, 8.0f, Interpolator.Easing.EaseInOut);
        }
예제 #18
0
        public Snapshot Interpolate(float matchTime)
        {
            snapshotBuffer.GetSnapshots(matchTime,
                                        out SnapshotWithTime s0, out SnapshotWithTime s1,
                                        out SnapshotWithTime s2, out SnapshotWithTime s3);

            //[0, 1]
            float    progress = (matchTime - s1.tickTime) / (s2.tickTime - s1.tickTime);
            Snapshot result   = Interpolator.Interpolate(progress, s0, s1, s2, s3);

            return(result);
        }
예제 #19
0
    public IEnumerator Animate(Transform T, Vector3 newPos, Lock locker = null)
    {
        if (locker != null)
        {
            locker.SignalStart();
        }

        Vector3 oldPos = T.position;

        for (float t = 0f; t < this.end; t += Time.deltaTime * speed * Options.Animation.movementSpeed)
        {
            T.position = I.Interpolate(t) * newPos + (1 - I.Interpolate(t)) * oldPos;
            yield return(new WaitForEndOfFrame());
        }

        T.position = newPos;

        if (locker != null)
        {
            locker.SignalStop();
        }
    }
예제 #20
0
    public static void SpriteFade(Interpolator interpolator, SpriteRenderer sprite, float startAplha, float endAlpha, float duration, AnimationCurve curve, Action onEnded = null)
    {
        void fade(float alpha)
        {
            var color = sprite.color;

            color.a      = alpha;
            sprite.color = color;
        }

        var interpolationData = new InterpolationData <float>(fade, startAplha, endAlpha, duration, curve, onEnded);

        interpolator.Interpolate(interpolationData);
    }
예제 #21
0
        public static Secret ReconstructFrom(IEnumerable <Share> shares)
        {
            if (shares.Count() < 2)
            {
                throw new InvalidDataException("There are needed at least 2 shares to recover any secret.");
            }

            if (!AssertDistinct(shares))
            {
                throw new InvalidDataException("Non-unique shares was provided. Unable to recover secret.");
            }

            var interpolator = new Interpolator(shares, Common.BasePrime);
            var secret       = interpolator.Interpolate();

            return(new Secret(secret.ToString("x")));
        }
예제 #22
0
        static void Postfix(SG_HiringHall_DetailPanel __instance, Pilot p, LocalizableText ___DescriptionText)
        {
            CrewDetails details = ModState.GetCrewDetails(p.pilotDef);

            StringBuilder sb = new StringBuilder();

            // Check hazard pay
            if (details.HazardPay > 0)
            {
                string hazardPayS = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Hazard_Pay],
                                             new object[] { SimGameState.GetCBillString(details.HazardPay) }).ToString();
                Mod.Log.Debug?.Write($"Hazard pay is: {hazardPayS}");
                sb.Append(hazardPayS);
                sb.Append("\n\n");
            }

            // Convert favored and hated faction
            if (details.FavoredFactionId > 0)
            {
                FactionValue faction         = FactionEnumeration.GetFactionByID(details.FavoredFactionId);
                string       favoredFactionS = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Dossier_Biography_Faction_Favored],
                                                        new object[] { faction.FactionDef.CapitalizedName }).ToString();
                sb.Append(favoredFactionS);
                sb.Append("\n\n");
                Mod.Log.Debug?.Write($"  Favored Faction is: {favoredFactionS}");
                //Mod.Log.Debug?.Write($"  Favored Faction => name: '{faction.Name}'  friendlyName: '{faction.FriendlyName}'  " +
                //    $"factionDef.Name: {faction.FactionDef?.Name}  factionDef.CapitalizedName: {faction.FactionDef.CapitalizedName}  " +
                //    $"factionDef.ShortName: {faction.FactionDef?.ShortName}  factionDef.CapitalizedShortName: {faction.FactionDef.CapitalizedShortName}  " +
                //    $"");
            }

            if (details.HatedFactionId > 0)
            {
                FactionValue faction       = FactionEnumeration.GetFactionByID(details.HatedFactionId);
                string       hatedFactionS = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Dossier_Biography_Faction_Hated],
                                                      new object[] { faction.FactionDef.CapitalizedName }).ToString();
                sb.Append(hatedFactionS);
                sb.Append("\n\n");
                Mod.Log.Debug?.Write($"  Hated Faction is: {hatedFactionS}");
            }

            sb.Append(Interpolator.Interpolate(p.pilotDef.Description.GetLocalizedDetails().ToString(true), ModState.SimGameState.Context, true));

            ___DescriptionText.SetText(sb.ToString());
        }
예제 #23
0
        /// <summary>
        /// Applies the interpolated value to a target
        /// </summary>
        /// <exception cref="Exception"></exception>
        protected virtual void ApplyValue()
        {
            //Debug.Log("ApplyValue StartValue: " + StartValue);
            //Debug.Log("ApplyValue EndValue: " + EndValue);

            try
            {
                _currentValue = Interpolator.Interpolate(_fraction, StartValue, EndValue);
            }
            catch (Exception ex)
            {
                TweenErrorSignal.Instance.Emit(Target, this, _fraction, StartValue, EndValue, ex);
            }

            if (null == _proxy)
            {
                throw new Exception("Proxy not defined: " + Name);
            }

            _proxy.SetValue(_currentValue);
        }
예제 #24
0
    void Update()
    {
        float  now   = Time.time;
        double value = (double)transform.position.y;

        foreach (double val in interpolator.Interpolate(now, value))
        {
            value = lowPassFilter.Filter(val);
            value = highPassFilter.Filter(value);

            // Nod happens upon negative movement, larger than threshold.
            if (readyToNod && value < -noddingThreshold)
            {
                readyToNod = false;
                Logger.Event("Nodding");
            }

            if (value < notNoddingThreshold && value > -notNoddingThreshold)
            {
                readyToNod = true;
            }
        }
    }
예제 #25
0
        protected string Interpolate(string str, IScope scope)
        {
            var s = GetInterpolationScope(scope);

            return(Interpolator.Interpolate(str, s));
        }
예제 #26
0
    private void SmoothMoveTo(Vector3 destination)
    {
        var data = new InterpolationData <Vector3>(move, transform.position, destination, animDuration, curve);

        interpolator.Interpolate(data);
    }
예제 #27
0
        public static void Postfix(List <ResultDescriptionEntry> __result, SimGameStat[] stats, GameContext context, string prefix)
        {
            var sim = UnityGameInstance.BattleTechGame.Simulation;

            if (Main.Settings.DependsOnArgoUpgrade && !sim.PurchasedArgoUpgrades.Contains(Main.Settings.ArgoUpgrade))
            {
                return;
            }

            if (stats.All(stat => !stat.name.StartsWith("Item.MECHPART.") && !stat.name.StartsWith("Item.MechDef.")))
            {
                return;
            }

            // remove blank result descriptions
            var removeResultDescription = new List <ResultDescriptionEntry>();

            foreach (var descriptionEntry in __result)
            {
                //Main.HBSLog.Log("descriptionEntry.Text: " + descriptionEntry.Text.ToString(false));
                if (descriptionEntry.Text.ToString(false).Contains("[[DM.SimGameStatDescDefs[MissingStatDescDef]"))
                {
                    removeResultDescription.Add(descriptionEntry);
                }
            }

            foreach (var entry in removeResultDescription)
            {
                __result.Remove(entry);
            }

            // add "real" descriptions for MECHPARTs or MechDefs
            var gameContext = new GameContext(context);

            foreach (var stat in stats)
            {
                if (!stat.name.StartsWith("Item.MECHPART.") && !stat.name.StartsWith("Item.MechDef."))
                {
                    continue;
                }

                var text   = "";
                var split  = stat.name.Split('.');
                var type   = split[1];
                var mechID = split[2];
                var num    = int.Parse(stat.value);

                switch (type)
                {
                case "MechDef":
                    text = $"Added [[DM.ChassisDefs[{mechID}],{{DM.ChassisDefs[{mechID}].Description.UIName}}]] to 'Mech storage";
                    break;

                case "MECHPART":
                    if (num > 0)
                    {
                        text = $"Added {num} [[DM.MechDefs[{mechID}],{{DM.MechDefs[{mechID}].Description.UIName}}]] Parts";
                    }
                    else
                    {
                        text = $"Removed {num * -1} [[DM.MechDefs[{mechID}],{{DM.MechDefs[{mechID}].Description.UIName}}]] Parts";
                    }
                    break;
                }

                __result.Add(new ResultDescriptionEntry(new Text(
                                                            $"{prefix} {Interpolator.Interpolate(text, gameContext, false)}"), gameContext, stat.name));
            }
        }
예제 #28
0
    private void AnimateBackground()
    {
        var data = new InterpolationData <float>(SetBackgroundAlpha, 0f, backgroundAlpha, backgroundFadeDuration, backgroundFadeCurve);

        interpolator.Interpolate(data);
    }
예제 #29
0
        /// <summary>
        /// Sets the value of the targetValues.Target attribute equal to the value of the sourceValues.Source attribute.
        /// </summary>
        /// <param name="sourceValues">The source values to assign from.</param>
        /// <param name="targetValues">The target values to assin to.</param>
        /// <param name="evaluator">An evaluator function providing an opportunity to inspect or modify the final value to assign.</param>
        public void Assign(ValueBag sourceValues, ValueBag targetValues, Func <string, string, dynamic, dynamic> evaluator = null)
        {
            evaluator = evaluator ?? ((source, target, value) => value);

            // find all of the source names delimited within {} braces.
            // scan the tokens, if source element ends in } then we have a column source value
            if (Interpolator.Interpolations(this.Source).Count == 0)
            {
                // if this is a literal assignment the source will begin with a single quote
                var sourceValue = this.Source.StartsWith("'")
                    ? this.Source.Trim("'".ToCharArray())
                    : sourceValues.GetValue(this.Source) ?? this.Default;

                // if we have a global values clause resolve the sourceValue to a value in the list
                sourceValue = ResolveToConstrainedValue("*", sourceValue);

                // if we have a source specific values clause; resolve the sourceValue to a value in the list
                sourceValue = ResolveToConstrainedValue(this.Source, sourceValue);

                // finally bind the result of the evaluator to our sources
                targetValues.SetValue(this.Target, evaluator(this.Source, this.Target, sourceValue));
            }
            else
            {
                targetValues.SetValue(this.Target, evaluator(this.Source, this.Target,
                                                             Interpolator.Interpolate(this.Source, sourceValues, (src, value) => {
                    // if we have a global values clause resolve the sourceValue to a value in the list
                    value = ResolveToConstrainedValue("*", value ?? this.Default);

                    // if we have a source specific values clause; resolve the sourceValue to a value in the list
                    value = ResolveToConstrainedValue(src, value);

                    // finally bind the result of the evaluator
                    return(evaluator(src, this.Target, value));
                })));
            }

            //// {colA} -- {colB} ==> colA}, -- , colB}
            //var sources = new Dictionary<string, dynamic>();
            //var results = expression.Matches(this.Source);
            //foreach (Match match in results) {
            //    var token = match.Value.Trim('{', '}');

            //    if (!sources.ContainsKey(token))
            //        sources.Add(token, null);
            //}

            //// If no braces present then use the source statement as is
            //if (sources.Count == 0)
            //    sources.Add(this.Source, null);

            //// bind the source values to our sources
            //foreach (var source in sources.Keys.ToList()) {
            //    // if this is a literal assignment the source will begin with a single quote
            //    var sourceValue = source.StartsWith("'")
            //        ? source.Trim("'".ToCharArray())
            //        : sourceValues.GetValue(source) ?? this.Default;

            //    // if we have a global values clause resolve the sourceValue to a value in the list
            //    sourceValue = ResolveToConstrainedValue("*", sourceValue);

            //    // if we have a source specific values clause; resolve the sourceValue to a value in the list
            //    sourceValue = ResolveToConstrainedValue(source, sourceValue);

            //    // finally bind the result of the evaluator to our sources
            //    sources[source] = evaluator(source, this.Target, sourceValue);
            //}

            //// assign the value
            //if (sources.Count > 1) {
            //    string interpolation = this.Source;

            //    foreach (var source in sources.Keys)
            //        interpolation = interpolation.Replace(string.Concat("{", source, "}"), string.Format("{0}", sources[source]));

            //    targetValues.SetValue(this.Target, interpolation);
            //} else
            //    targetValues.SetValue(this.Target, sources[this.Source]);

            //targetValues.SetValue(this.Target, Console.Interpolate(this.Source, sourceValues, (src, value) => {
            //        // if we have a global values clause resolve the sourceValue to a value in the list
            //        value = ResolveToConstrainedValue("*", value ?? this.Default);

            //        // if we have a source specific values clause; resolve the sourceValue to a value in the list
            //        value = ResolveToConstrainedValue(src, value);

            //        // finally bind the result of the evaluator
            //        return evaluator(src, this.Target, value);
            //    }));
        }
예제 #30
0
 public float[] GetMotionWeights(Vector3 velocity)
 {
     return(interpolator.Interpolate(new float[] { velocity.x, velocity.y, velocity.z }));
 }