/// <summary> /// Initializes a new instance of the <see cref="ParticleSystemManager"/> class. /// </summary> public ParticleSystemManager() { _updateParticleSystem = UpdateParticleSystem; // Cannot access Environment.ProcessorCount in phone app. (Security issue.) EnableMultithreading = false; #else // Enable multithreading by default if the current system has multiple processors. EnableMultithreading = Environment.ProcessorCount > 1; // Multithreading works but Parallel.For of Xamarin.Android/iOS is very inefficient. if (GlobalSettings.PlatformID == PlatformID.Android || GlobalSettings.PlatformID == PlatformID.iOS) EnableMultithreading = false; ParticleSystems = new ParticleSystemCollection(); ParticleSystems.CollectionChanged += OnParticleSystemsChanged; }
protected virtual void CloneCore(ParticleSystem source) { Name = source.Name; Enabled = source.Enabled; MaxNumberOfParticles = source.MaxNumberOfParticles; InitialDelay = source.InitialDelay; PreloadDuration = source.PreloadDuration; PreloadDeltaTime = source.PreloadDeltaTime; TimeScaling = source.TimeScaling; EnableMultithreading = source.EnableMultithreading; ReferenceFrame = source.ReferenceFrame; // Cloning the particle parameter collection is tricky because the parameters are generics. // We use an internal method of the parameter to do the job. foreach (var parameter in source.Parameters) { ((IParticleParameterInternal)parameter).AddCopyToCollection(Parameters); } foreach (var effector in source.Effectors) { Effectors.Add(effector.Clone()); } if (source.Children != null) { Children = new ParticleSystemCollection(); foreach (var particleSystem in source.Children) { Children.Add(particleSystem.Clone()); } } Pose = source.Pose; Shape = source.Shape.Clone(); }