public void PasteParameterToProperty(ParameterToProperty source, ParameterToProperty target)
 {
     for (int i = 0; i < _parameters.Length; i++)
     {
         if (_parameters[i] == target)
         {
             DeepCopy(source, target);
             break;
         }
     }
 }
        public void AddParameterToProperty()
        {
            _parameters = MyArray <ParameterToProperty> .Resize(_parameters, _parameters.Length + 1);

            ParameterToProperty parameterToProperty = new ParameterToProperty();

            parameterToProperty._envelope            = new Envelope();
            parameterToProperty._envelope._points    = new Point[2];
            parameterToProperty._envelope._points[0] = Point.Alloc(0f, 0f, CurveTypes.Linear);
            parameterToProperty._envelope._points[1] = Point.Alloc(1f, 1f, CurveTypes.Linear);
            _parameters[_parameters.Length - 1]      = parameterToProperty;
        }
        public void DeleteParameterToProperty(ParameterToProperty parameterToProperty)
        {
            for (int i = 0; i < _parameters.Length; i++)
            {
                if (_parameters[i] == parameterToProperty)
                {
                    _parameters = MyArray <ParameterToProperty> .RemoveAt(_parameters, i);

                    break;
                }
            }
        }
        public static void DeepCopy(ParameterToProperty source, ParameterToProperty target)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (Serialization.IField item in Serialization.EnumerateFields(source))
            {
                dictionary[item.FieldName] = item.GetValue();
            }
            foreach (Serialization.IField item2 in Serialization.EnumerateFields(target))
            {
                item2.SetValue(dictionary[item2.FieldName]);
            }
        }
        public override bool UpdateInternal(ref Context context)
        {
            if (_controlParameter == null || _parameters == null || _regions == null)
            {
                return(false);
            }
            float num = 0f;

            if ((bool)_controlParameter)
            {
                num = _controlParameter.GetNormalisedCurrentValue();
            }
            float num2 = 1f;
            float num3 = 1f;

            for (int i = 0; i < _parameters.Length; i++)
            {
                ParameterToProperty parameterToProperty = _parameters[i];
                if (parameterToProperty != null && parameterToProperty._parameter != null)
                {
                    if (parameterToProperty._property == Property.Volume)
                    {
                        num2 *= parameterToProperty._envelope.Calculate_y(parameterToProperty._parameter.GetNormalisedCurrentValue());
                    }
                    else if (parameterToProperty._property == Property.Pitch)
                    {
                        float num4 = parameterToProperty._envelope.Calculate_y(parameterToProperty._parameter.GetNormalisedCurrentValue());
                        num3 *= Mathf.Pow(2f, num4 * 8f - 4f);
                    }
                }
            }
            for (int j = 0; j < _regions.Length; j++)
            {
                TimelineRegion timelineRegion = _regions[j];
                float          num5           = Mathf.Round(num * _controlParameter._max * 100f) / 100f;
                float          num6           = Mathf.Round(timelineRegion._x * _controlParameter._max * 100f) / 100f;
                float          num7           = num6 + Mathf.Round(timelineRegion._width * _controlParameter._max * 100f) / 100f;
                if (_componentInstance != null && num5 >= num6 && num5 <= num7)
                {
                    float num8 = 1f;
                    if (num != 0f && num != 1f)
                    {
                        num8 = timelineRegion._volumeEnvelope.Calculate_y(num);
                    }
                    timelineRegion.Volume = num8 * num2 * timelineRegion._regionVolume;
                    float num9 = 1f;
                    if (timelineRegion._autopitchenabled)
                    {
                        num9 = 0f + num / timelineRegion._autopitchreference * 1f;
                    }
                    timelineRegion.Pitch = num9 * num3;
                    if (!timelineRegion.IsPlaying() && _layerIsActive)
                    {
                        timelineRegion.PlayInternal(_componentInstance, 0f, 0.5f);
                    }
                    else if (!IsOneShot() && timelineRegion._loopMode == RegionLoopMode.PlayToEnd && timelineRegion.HasReachedEnd())
                    {
                        timelineRegion.StopInternal(stopInstances: false, forceStop: false, 0f, 0.5f);
                    }
                }
                else if (timelineRegion.IsPlaying())
                {
                    if (timelineRegion._loopMode == RegionLoopMode.Cutoff)
                    {
                        timelineRegion.StopInternal(stopInstances: false, forceStop: true, 0f, 0.5f);
                    }
                    else if (timelineRegion._loopMode == RegionLoopMode.PlayToEnd)
                    {
                        timelineRegion._regionIsActive = false;
                    }
                }
                if (timelineRegion._loopMode == RegionLoopMode.PlayToEnd && !timelineRegion.IsOneShot() && timelineRegion.HasReachedEnd())
                {
                    timelineRegion.StopInternal(stopInstances: false, forceStop: false, 0f, 0.5f);
                }
            }
            bool flag = false;

            flag = base.UpdateInternal(ref context);
            if (((TimelineComponent)_parentComponent)._isOneShot || !_layerIsActive)
            {
                _isComponentActive = flag;
                if (!_isComponentActive)
                {
                    _layerIsActive = false;
                }
            }
            else
            {
                _isComponentActive = _layerIsActive;
            }
            return(_isComponentActive);
        }