Пример #1
0
        public static ParticleInfo[] CreateParticleInfo(string assetPath)
        {
            if (!EditorPath.IsPrefab(assetPath))
            {
                return(null);
            }

            GameObject prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetPath);

            ParticleSystem[] particleSystem = prefab.GetComponentsInChildren <ParticleSystem>();
            ParticleInfo[]   particleInfo   = new ParticleInfo[particleSystem.Length];

            for (int i = 0; i < particleSystem.Length; i++)
            {
                particleInfo[i]              = new ParticleInfo();
                particleInfo[i].Path         = assetPath;
                particleInfo[i].RealPath     = assetPath + "/" + ViewerConst.GetPath(particleSystem[i].transform);
                particleInfo[i].MaxParticles = particleSystem[i].main.maxParticles;
                particleInfo[i].Duration     = particleSystem[i].main.duration;
                particleInfo[i].PlayOnAwake  = particleSystem[i].main.playOnAwake;
                particleInfo[i].Looping      = particleSystem[i].main.loop;
            }

            return(particleInfo);
        }
Пример #2
0
 public ParticleViewerData(string mode, ParticleInfo particleInfo)
 {
     _mode         = (ParticleViewerMode)Enum.Parse(typeof(ParticleViewerMode), mode);
     MaxParticle   = particleInfo.MaxParticles;
     SizeIndex     = ViewerConst.GetParticleSizeIndex(particleInfo.MaxParticles);
     SizeStr       = ViewerConst.ParticleSizeStr[SizeIndex];
     Duration      = particleInfo.Duration;
     DurationIndex = ViewerConst.GetDurationIndex(particleInfo.Duration);
     DurtationStr  = ViewerConst.DurationSizeStr[DurationIndex];
     PlayOnAwake   = particleInfo.PlayOnAwake;
     Looping       = particleInfo.Looping;
 }
Пример #3
0
        private bool isMatch(ParticleInfo particleInfo)
        {
            switch (_mode)
            {
            case ParticleViewerMode.MaxParticle:
                return(SizeIndex == ViewerConst.GetParticleSizeIndex(particleInfo.MaxParticles));

            case ParticleViewerMode.Duration:
                return(DurationIndex == ViewerConst.GetDurationIndex(particleInfo.Duration));

            case ParticleViewerMode.PlayOnAwake:
                return(PlayOnAwake == particleInfo.PlayOnAwake);

            case ParticleViewerMode.Looping:
                return(Looping == particleInfo.Looping);
            }
            return(false);
        }
Пример #4
0
 private void addObject(ParticleInfo modelInfo)
 {
     _object.Add(modelInfo);
     Count++;
 }