protected virtual void GeneratePlotters()
        {
            this.transform.MMDestroyAllChildren();

            BindingFlags flags = BindingFlags.Public | BindingFlags.Static;

            MethodInfo[] methods = typeof(MMTweenDefinitions).GetMethods(flags);

            int   row         = 0;
            int   column      = 0;
            float yCoordinate = 0;

            for (int i = 0; i < methods.Length; i++)
            {
                _position.x = column * Spacing.x;


                _position.y = yCoordinate;

                MMPlotter plotter = Instantiate(PlotterPrefab);
                plotter.transform.SetParent(this.transform);
                plotter.transform.localPosition = _position;
                plotter.TweenMethodIndex        = i;
                string tweenName = plotter.TweenName(plotter.TweenMethodIndex);
                plotter.gameObject.name = tweenName;

                Material newMaterial = LinearMaterial;
                if (tweenName.Contains("Linear"))
                {
                    newMaterial = LinearMaterial;
                }
                if (tweenName.Contains("Quadratic"))
                {
                    newMaterial = QuadraticMaterial;
                }
                if (tweenName.Contains("Cubic"))
                {
                    newMaterial = CubicMaterial;
                }
                if (tweenName.Contains("Quartic"))
                {
                    newMaterial = QuarticMaterial;
                }
                if (tweenName.Contains("Quintic"))
                {
                    newMaterial = QuinticMaterial;
                }
                if (tweenName.Contains("Sinusoidal"))
                {
                    newMaterial = SinusoidalMaterial;
                }
                if (tweenName.Contains("Bounce"))
                {
                    newMaterial = BounceMaterial;
                }
                if (tweenName.Contains("Overhead"))
                {
                    newMaterial = OverheadMaterial;
                }
                if (tweenName.Contains("Exponential"))
                {
                    newMaterial = ExponentialMaterial;
                }
                if (tweenName.Contains("Elastic"))
                {
                    newMaterial = ElasticMaterial;
                }
                if (tweenName.Contains("Circular"))
                {
                    newMaterial = CircularMaterial;
                }

                plotter.SetMaterial(newMaterial);
                plotter.GetMethodsList();
                plotter.DrawGraph();

                if (column >= RowLength - 1)
                {
                    column = 0;
                    row++;
                    if (row % 2 == 0)
                    {
                        yCoordinate += Spacing.y + VerticalOddSpacing;
                    }
                    else
                    {
                        yCoordinate += Spacing.y;
                    }
                }
                else
                {
                    column++;
                }
            }
        }
Esempio n. 2
0
 protected virtual void OnEnable()
 {
     _mmPlotter    = target as MMPlotter;
     _typeDisplays = _mmPlotter.GetMethodsList();
 }