コード例 #1
0
ファイル: Interpolator.cs プロジェクト: widVE/UnityScripts
        /// <summary>
        /// Sets the RawValue of this Interpolator and invokes the value changed events.
        /// </summary>
        public void SetRawValue(float rawValue, bool notify = true)
        {
            _rawValue = Mathf.Clamp01(rawValue);

            if (notify)
            {
                //invoke value changed events for any scripts that use them
                RawValueChanged?.Invoke(RawValue);
                ValueChanged?.Invoke(Value);

                //let attached objects know that value has changed as well
                for (int i = 0; i < InterpolatableObjects.Count; i++)
                {
                    GameObject io = InterpolatableObjects[i];
                    if (!io || !io.activeInHierarchy)
                    {
                        continue;
                    }

                    //set value on all IInterpolatable components from the attached GameObject
                    foreach (IInterpolatable ii in io.GetComponents <IInterpolatable>())
                    {
                        //skip disabled objects
                        if (!ii.IsActive())
                        {
                            continue;
                        }

                        //set the value!
                        ii.SetValue(Value);
                    }
                }
            }
        }
コード例 #2
0
ファイル: FlagsListBox.xaml.cs プロジェクト: play3577/Emux
 protected virtual void OnRawValueChanged()
 {
     RawValueChanged?.Invoke(this, EventArgs.Empty);
 }