Beispiel #1
0
        protected void ApplyOptionDelayed(AudioOption option, bool recycle)
        {
            var delayedOption = TypePoolManager.Create <AudioDelayedOption>();

            delayedOption.Initialize(option, recycle, getDeltaTime);
            delayedOptions.Add(delayedOption);
        }
Beispiel #2
0
        public void SetValue(IList array, int index)
        {
            if (array == null)
            {
                return;
            }

            if (array.Count > index)
            {
                var target = array[index];

                if (target == null)
                {
                    if (isUnityObject)
                    {
                        return;
                    }
                    else
                    {
                        target = array[index] = TypePoolManager.Create(source.GetType());
                    }
                }

                copier.CopyTo(source, target);
            }
        }
Beispiel #3
0
        public void SetValue(IList array, int index)
        {
            if (array == null)
            {
                return;
            }

            if (array.Count > index)
            {
                var value = array[index];

                if (value == null)
                {
                    if (isUnityObject)
                    {
                        return;
                    }
                    else
                    {
                        value = array[index] = TypePoolManager.Create(elementType);
                    }
                }

                PoolUtility.InitializeFields(value, setters);
            }
        }
Beispiel #4
0
        public static List <IComponentOld> DeserializeComponents(string data)
        {
            List <IComponentOld> components;

            using (var reader = new StringReader(data))
            {
                int count = int.Parse(reader.ReadLine());
                components = new List <IComponentOld>(count);

                for (int i = 0; i < count; i++)
                {
                    var type = TypeUtility.GetType(reader.ReadLine());
                    var line = reader.ReadLine();

                    if (type != null)
                    {
                        var component = TypePoolManager.Create(type);
                        JsonUtility.FromJsonOverwrite(line, component);
                        components.Add((IComponentOld)component);
                    }
                }
            }

            return(components);
        }
Beispiel #5
0
        public IComponentOld AddComponent(Type type)
        {
            var component = (IComponentOld)TypePoolManager.Create(type);

            AddComponent(component, true);

            return(component);
        }
Beispiel #6
0
        public IAudioItem CreateDynamicItem(DynamicGetter getNextSettings, Func <Vector3> getPosition)
        {
            var spatializer = TypePoolManager.Create <AudioSpatializer>();

            spatializer.Initialize(getPosition);

            return(CreateDynamicItem(getNextSettings, spatializer, null));
        }
Beispiel #7
0
        public AudioDynamicItem CreateDynamicItem(DynamicGetter getNextSettings, AudioSpatializer spatializer, IAudioItem parent)
        {
            var item = TypePoolManager.Create <AudioDynamicItem>();

            item.Initialize(getNextSettings, this, spatializer, parent);

            return(item);
        }
Beispiel #8
0
        public IAudioItem CreateItem(AudioSettingsBase settings, Func <Vector3> getPosition)
        {
            var spatializer = TypePoolManager.Create <AudioSpatializer>();

            spatializer.Initialize(getPosition);

            return(CreateItem(settings, spatializer, null));
        }
Beispiel #9
0
        static AudioOption Create(Types type, object value, float delay = 0f)
        {
            var option = TypePoolManager.Create <AudioOption>();

            option.Initialize(type, value, delay);

            return(option);
        }
Beispiel #10
0
        public IAudioItem CreateDynamicItem(DynamicGetter getNextSettings, Transform follow)
        {
            var spatializer = TypePoolManager.Create <AudioSpatializer>();

            spatializer.Initialize(follow);

            return(CreateDynamicItem(getNextSettings, spatializer, null));
        }
Beispiel #11
0
        public IAudioItem CreateItem(AudioSettingsBase settings, Transform follow)
        {
            var spatializer = TypePoolManager.Create <AudioSpatializer>();

            spatializer.Initialize(follow);

            return(CreateItem(settings, spatializer, null));
        }
Beispiel #12
0
        public void Initialize(DynamicGetter getNextSettings, AudioItemManager itemManager, AudioSpatializer spatializer, IAudioItem parent)
        {
            settings = TypePoolManager.Create <AudioDynamicSettings>();

            base.Initialize(settings.Identifier, itemManager, spatializer, parent);

            this.getNextSettings = getNextSettings ?? delegate { return(null); };

            InitializeModifiers(settings);
            InitializeSources();
        }
Beispiel #13
0
        public static AudioValue <float> GetGlobalRTPCValue(string name)
        {
            AudioValue <float> value;

            if (!rtpcValues.TryGetValue(name, out value))
            {
                value            = TypePoolManager.Create <AudioValue <float> >();
                rtpcValues[name] = value;
            }

            return(value);
        }
Beispiel #14
0
        /// <summary>
        /// Gets an AudioValue containing the current switch value.
        /// </summary>
        /// <param name="name">The name of the switch.</param>
        /// <returns>The AudioValue.</returns>
        public AudioValue <int> GetSwitchValue(string name)
        {
            AudioValue <int> value;

            if (!switchValues.TryGetValue(name, out value))
            {
                value = TypePoolManager.Create <AudioValue <int> >();
                switchValues[name] = value;
            }

            return(value);
        }
Beispiel #15
0
        public void Trigger <TId, TArg1, TArg2, TArg3>(TId identifier, TArg1 argument1, TArg2 argument2, TArg3 argument3)
        {
            var eventGroup = GetEventGroup <TId>();
            var eventData  = TypePoolManager.Create <TriggerEvent <TId, TArg1, TArg2, TArg3> >();

            eventData.EventGroup = eventGroup;
            eventData.Identifier = identifier;
            eventData.Argument1  = argument1;
            eventData.Argument2  = argument2;
            eventData.Argument3  = argument3;

            Trigger((IEvent)eventData, 0f);
        }
Beispiel #16
0
        public virtual void OnCreate()
        {
            if (Scope == RTPCScope.Local)
            {
                value = TypePoolManager.Create <AudioValue <float> >();
            }
            else
            {
                value = GetGlobalRTPCValue(Name);
            }

            lastValue = Curve.Evaluate(GetRatio());
        }
Beispiel #17
0
        ComponentGroupBase CreateComponentGroup(Type componentType)
        {
            var componentGroupType = ComponentUtility.GetComponentGroupType(componentType);
            var componentGroup     = (ComponentGroupBase)TypePoolManager.Create(componentGroupType);

            bool success = false;

            for (int i = 0; i < allComponents.Count; i++)
            {
                success |= componentGroup.TryAdd(allComponents[i]);
            }

            if (success)
            {
                AddComponentIndex(ComponentUtility.GetComponentIndex(componentType));
            }

            return(componentGroup);
        }
Beispiel #18
0
        public AudioItemBase CreateItem(AudioSettingsBase settings, AudioSpatializer spatializer, IAudioItem parent)
        {
            if (settings == null)
            {
                return(null);
            }

            switch (settings.Type)
            {
            default:
                var sourceItem = TypePoolManager.Create <AudioSourceItem>();
                var source     = PrefabPoolManager.Create(audioManager.Reference);
                source.Copy(audioManager.Reference, audioManager.UseCustomCurves);
                sourceItem.Initialize((AudioSourceSettings)settings, this, source, spatializer, parent);
                return(sourceItem);

            case AudioTypes.MixContainer:
                var mixContainerItem = TypePoolManager.Create <AudioMixContainerItem>();
                mixContainerItem.Initialize((AudioMixContainerSettings)settings, this, spatializer, parent);
                return(mixContainerItem);

            case AudioTypes.RandomContainer:
                var randomContainerItem = TypePoolManager.Create <AudioRandomContainerItem>();
                randomContainerItem.Initialize((AudioRandomContainerSettings)settings, this, spatializer, parent);
                return(randomContainerItem);

            case AudioTypes.EnumeratorContainer:
                var enumeratorContainerItem = TypePoolManager.Create <AudioEnumeratorContainerItem>();
                enumeratorContainerItem.Initialize((AudioEnumeratorContainerSettings)settings, this, spatializer, parent);
                return(enumeratorContainerItem);

            case AudioTypes.SwitchContainer:
                var switchContainerItem = TypePoolManager.Create <AudioSwitchContainerItem>();
                switchContainerItem.Initialize((AudioSwitchContainerSettings)settings, this, spatializer, parent);
                return(switchContainerItem);

            case AudioTypes.SequenceContainer:
                var sequenceContainerItem = TypePoolManager.Create <AudioSequenceContainerItem>();
                sequenceContainerItem.Initialize((AudioSequenceContainerSettings)settings, this, spatializer, parent);
                return(sequenceContainerItem);
            }
        }
Beispiel #19
0
        protected void UpdateSequence()
        {
            if (breakSequence || (sources.Count > 0 && !requestNextSettings))
            {
                return;
            }

            var data     = TypePoolManager.Create <AudioDynamicData>();
            var settings = getNextSettings(this, data);

            currentStep++;

            if (settings == null || state == AudioStates.Stopped)
            {
                breakSequence = true;
            }
            else
            {
                AddSource(settings, data);
            }
        }
Beispiel #20
0
        public void SetValue(object instance)
        {
            if (instance == null)
            {
                return;
            }

            var target = field.GetValue(instance);

            if (target == null)
            {
                if (isUnityObject)
                {
                    return;
                }
                else
                {
                    field.SetValue(instance, target = TypePoolManager.Create(source.GetType()));
                }
            }

            copier.CopyTo(source, target);
        }
Beispiel #21
0
        public void SetValue(object instance)
        {
            if (instance == null)
            {
                return;
            }

            var value = field.GetValue(instance);

            if (value == null)
            {
                if (isUnityObject)
                {
                    return;
                }
                else
                {
                    field.SetValue(instance, value = TypePoolManager.Create(type));
                }
            }

            PoolUtility.InitializeFields(value, setters);
        }
Beispiel #22
0
        public IAudioItem CreateDynamicItem(DynamicGetter getNextSettings)
        {
            var spatializer = TypePoolManager.Create <AudioSpatializer>();

            return(CreateDynamicItem(getNextSettings, spatializer, null));
        }
Beispiel #23
0
 void IPoolable.OnCreate()
 {
     value = TypePoolManager.Create <DynamicValue>();
 }
Beispiel #24
0
        public IAudioItem CreateItem(AudioSettingsBase settings)
        {
            var spatializer = TypePoolManager.Create <AudioSpatializer>();

            return(CreateItem(settings, spatializer, null));
        }